diff options
author | Simon Martin <simartin@users.sourceforge.net> | 2010-11-06 21:58:50 +0000 |
---|---|---|
committer | Simon Martin <simartin@gcc.gnu.org> | 2010-11-06 21:58:50 +0000 |
commit | c58e98c83bb5319ac03730825ad9c68d46d4263f (patch) | |
tree | a3af35a9778f3dd10514c305f40f52ad48c7cfda /gcc/c-decl.c | |
parent | da0dc81873164e5d105e00b55deb9b4f961d26a4 (diff) | |
download | gcc-c58e98c83bb5319ac03730825ad9c68d46d4263f.zip gcc-c58e98c83bb5319ac03730825ad9c68d46d4263f.tar.gz gcc-c58e98c83bb5319ac03730825ad9c68d46d4263f.tar.bz2 |
re PR c/43384 (ICE: Segmentation fault with invalid K&R-like code)
gcc/
2010-11-16 Simon Martin <simartin@users.sourceforge.net>
PR c/43384
* c-decl.c (lookup_label): Labels can only be referenced in a
function's scope.
(store_parm_decls_oldstyle): Skip erroneous parameters.
gcc/testsuite/
2010-11-16 Simon Martin <simartin@users.sourceforge.net>
PR c/43384
* gcc.dg/parser-error-3.c: New test.
From-SVN: r166408
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 7d27dfe..e1f1402 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3013,7 +3013,7 @@ lookup_label (tree name) tree label; struct c_label_vars *label_vars; - if (current_function_decl == 0) + if (current_function_scope == 0) { error ("label %qE referenced outside of any function", name); return 0; @@ -7847,6 +7847,9 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) if (b && B_IN_CURRENT_SCOPE (b)) { decl = b->decl; + /* Skip erroneous parameters. */ + if (decl == error_mark_node) + continue; /* If we got something other than a PARM_DECL it is an error. */ if (TREE_CODE (decl) != PARM_DECL) error_at (DECL_SOURCE_LOCATION (decl), |