diff options
author | James A. Morrison <phython@gcc.gnu.org> | 2004-12-21 17:01:08 +0000 |
---|---|---|
committer | James A. Morrison <phython@gcc.gnu.org> | 2004-12-21 17:01:08 +0000 |
commit | 6f17bbcf0518928c510fcc8c7bbb48c0ec21a8f3 (patch) | |
tree | 4f41c122c72dec3b860a1cabdb23536dbf18fbee /gcc/c-parse.in | |
parent | 41afe4ef3e66834becefe1d2ad5e879c878f1008 (diff) | |
download | gcc-6f17bbcf0518928c510fcc8c7bbb48c0ec21a8f3.tar.gz |
re PR c/18596 (ICE in make_decl_rtl)
2004-12-19 James A. Morrison <phython@gcc.gnu.org>
PR c/18596
* c-parse.in (initdcl): Don't process a declaration if start_decl fails.
(notype_initdcl): Don't process a declaration if start_decl fails.
* c-decl.c (start_decl): Fail if grokdeclarator fails.
(grokdeclarator): Fail if a function definition has an invalid storage
class.
* c-typeck.c (start_init): Treat error_mark_node the same as 0.
testsuite:
PR c/18596
* gcc.dg/funcdef-storage-1.c (foo): Remove.
* gcc.dg/pr18596-1.c: Use dg-error.
(dg-options): Use -fno-unit-at-a-time.
* gcc.dg/pr18596-2.c: New test.
* gcc.dg/pr18596-3.c: New test.
From-SVN: r92459
Diffstat (limited to 'gcc/c-parse.in')
-rw-r--r-- | gcc/c-parse.in | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 86880ac6153..94df4bbc3b0 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -1321,16 +1321,23 @@ initdcl: declarator maybeasm maybe_attribute '=' { $<ttype>$ = start_decl ($1, current_declspecs, true, chainon ($3, all_prefix_attributes)); + if (!$<ttype>$) + $<ttype>$ = error_mark_node; start_init ($<ttype>$, $2, global_bindings_p ()); } init /* Note how the declaration of the variable is in effect while its init is parsed! */ { finish_init (); - maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6); - finish_decl ($<ttype>5, $6.value, $2); } + if ($<ttype>5 != error_mark_node) + { + maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6); + finish_decl ($<ttype>5, $6.value, $2); + } + } | declarator maybeasm maybe_attribute { tree d = start_decl ($1, current_declspecs, false, chainon ($3, all_prefix_attributes)); - finish_decl (d, NULL_TREE, $2); + if (d) + finish_decl (d, NULL_TREE, $2); } ; @@ -1338,16 +1345,23 @@ notype_initdcl: notype_declarator maybeasm maybe_attribute '=' { $<ttype>$ = start_decl ($1, current_declspecs, true, chainon ($3, all_prefix_attributes)); + if (!$<ttype>$) + $<ttype>$ = error_mark_node; start_init ($<ttype>$, $2, global_bindings_p ()); } init /* Note how the declaration of the variable is in effect while its init is parsed! */ { finish_init (); - maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6); - finish_decl ($<ttype>5, $6.value, $2); } + if ($<ttype>5 != error_mark_node) + { + maybe_warn_string_init (TREE_TYPE ($<ttype>5), $6); + finish_decl ($<ttype>5, $6.value, $2); + } + } | notype_declarator maybeasm maybe_attribute { tree d = start_decl ($1, current_declspecs, false, chainon ($3, all_prefix_attributes)); - finish_decl (d, NULL_TREE, $2); } + if (d) + finish_decl (d, NULL_TREE, $2); } ; /* the * rules are dummies to accept the Apollo extended syntax so that the header files compile. */ |