From 6c99c37ba9c501cf387a81d1e2b5c40c710dc571 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Mon, 11 Sep 1995 19:05:26 -0400 Subject: [PATCH] (digest_init): Don't recursively call digest_init when in traditional mode if the type is invalid. From-SVN: r10315 --- gcc/c-typeck.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 11b93d77972..75df0837a41 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -4894,7 +4894,7 @@ digest_init (type, init, require_constant, constructor_constant) and it initializes the first element of x to 0. */ if (flag_traditional) { - tree top = 0, prev = 0; + tree top = 0, prev = 0, otype = type; while (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == QUAL_UNION_TYPE @@ -4916,11 +4916,17 @@ digest_init (type, init, require_constant, constructor_constant) return error_mark_node; } } - TREE_OPERAND (prev, 1) - = build_tree_list (NULL_TREE, - digest_init (type, init, require_constant, - constructor_constant)); - return top; + + if (otype != type) + { + TREE_OPERAND (prev, 1) + = build_tree_list (NULL_TREE, + digest_init (type, init, require_constant, + constructor_constant)); + return top; + } + else + return error_mark_node; } error_init ("invalid initializer%s", " for `%s'", NULL); return error_mark_node; -- 2.30.2