diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-09-11 19:05:26 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-09-11 19:05:26 -0400 |
commit | 6c99c37ba9c501cf387a81d1e2b5c40c710dc571 (patch) | |
tree | 997208a38a3ab750f5803d3c74c2162b47c558d2 /gcc | |
parent | ebe9f727648ca753e81fe3778895b95713e2b7ef (diff) | |
download | gcc-6c99c37ba9c501cf387a81d1e2b5c40c710dc571.zip gcc-6c99c37ba9c501cf387a81d1e2b5c40c710dc571.tar.gz gcc-6c99c37ba9c501cf387a81d1e2b5c40c710dc571.tar.bz2 |
(digest_init): Don't recursively call digest_init when in traditional
mode if the type is invalid.
From-SVN: r10315
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-typeck.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 11b93d7..75df083 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; |