diff options
author | James A. Morrison <phython@gcc.gnu.org> | 2004-11-30 00:32:34 +0000 |
---|---|---|
committer | James A. Morrison <phython@gcc.gnu.org> | 2004-11-30 00:32:34 +0000 |
commit | 1ac0ac8b905ca91a7b5b8af907237133d65f2a5c (patch) | |
tree | 576efc3fd518c2953b5a4114998ec54ad0f7f78e /gcc/c-decl.c | |
parent | 1590d64e4f83b44daa382d1f2efa8f2d587304d3 (diff) | |
download | gcc-1ac0ac8b905ca91a7b5b8af907237133d65f2a5c.zip gcc-1ac0ac8b905ca91a7b5b8af907237133d65f2a5c.tar.gz gcc-1ac0ac8b905ca91a7b5b8af907237133d65f2a5c.tar.bz2 |
re PR c/18596 (ICE in make_decl_rtl)
2004-11-26 James A. Morrison <phython@gcc.gnu.org>
PR middle-end/18596
* c-decl.c (grokdeclarator): Reset DECL_INTIAL to error_mark_node
on errors.
testsuite:
* gcc.dg/pr18596-1.c: New test.
From-SVN: r91504
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 3c8dbee..ea26da4 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4428,8 +4428,15 @@ grokdeclarator (const struct c_declarator *declarator, } else if (TREE_CODE (type) == FUNCTION_TYPE) { + decl = build_decl (FUNCTION_DECL, declarator->u.id, type); + decl = build_decl_attribute_variant (decl, decl_attr); + if (storage_class == csc_register || threadp) - error ("invalid storage class for function %qs", name); + { + error ("invalid storage class for function %qs", name); + if (DECL_INITIAL (decl) != NULL_TREE) + DECL_INITIAL (decl) = error_mark_node; + } else if (current_scope != file_scope) { /* Function declaration not at file scope. Storage @@ -4443,12 +4450,13 @@ grokdeclarator (const struct c_declarator *declarator, pedwarn ("invalid storage class for function %qs", name); } if (storage_class == csc_static) - error ("invalid storage class for function %qs", name); + { + error ("invalid storage class for function %qs", name); + if (DECL_INITIAL (decl) != NULL_TREE) + DECL_INITIAL (decl) = error_mark_node; + } } - decl = build_decl (FUNCTION_DECL, declarator->u.id, type); - decl = build_decl_attribute_variant (decl, decl_attr); - DECL_LANG_SPECIFIC (decl) = GGC_CNEW (struct lang_decl); if (pedantic && type_quals && !DECL_IN_SYSTEM_HEADER (decl)) |