From a23faf7a4f172a09bfb095081491dff1225cbf52 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 25 May 2016 14:58:39 +0000 Subject: [PATCH] re PR c/71266 (gcc ICE on x86_64-linux-gnu in "store_parm_decls_oldstyle") PR c/71266 * c-decl.c (store_parm_decls_oldstyle): Skip non-PARM_DECLs. * gcc.dg/noncompile/old-style-parm-3.c: New test. From-SVN: r236708 --- gcc/c/ChangeLog | 3 +++ gcc/c/c-decl.c | 7 +++++-- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/noncompile/old-style-parm-3.c | 9 +++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/noncompile/old-style-parm-3.c diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index d74423b816d..f3bb0e9d58a 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -3,6 +3,9 @@ PR c/71265 * c-decl.c (c_make_fname_decl): Don't check seen_error. + PR c/71266 + * c-decl.c (store_parm_decls_oldstyle): Skip non-PARM_DECLs. + 2016-05-24 Cesar Philippidis * c-parser.c (c_parser_oacc_declare): Add support for diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index d7c3783d989..d79802ee72c 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -8605,8 +8605,11 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) 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), - "%qD declared as a non-parameter", decl); + { + error_at (DECL_SOURCE_LOCATION (decl), + "%qD declared as a non-parameter", decl); + continue; + } /* If the declaration is already marked, we have a duplicate name. Complain and ignore the duplicate. */ else if (seen_args.contains (decl)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c1a5372bb7a..1b1b97e2c73 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ PR c/71265 * gcc.dg/noncompile/pr71265.c: New test. + PR c/71266 + * gcc.dg/noncompile/old-style-parm-3.c: New test. + 2016-05-25 Nathan Sidwell * gcc.c-torture/execute/921110-1.c: Fix abort decl. diff --git a/gcc/testsuite/gcc.dg/noncompile/old-style-parm-3.c b/gcc/testsuite/gcc.dg/noncompile/old-style-parm-3.c new file mode 100644 index 00000000000..f9d6d0f686a --- /dev/null +++ b/gcc/testsuite/gcc.dg/noncompile/old-style-parm-3.c @@ -0,0 +1,9 @@ +/* PR c/71266 */ +/* { dg-do compile } */ + +int fn1 (a) + enum b { /* { dg-warning "empty declaration" } */ + a /* { dg-error ".a. declared as a non-parameter" } */ + }; +{ +} -- 2.30.2