re PR c/71266 (gcc ICE on x86_64-linux-gnu in "store_parm_decls_oldstyle")
authorMarek Polacek <polacek@redhat.com>
Wed, 25 May 2016 14:58:39 +0000 (14:58 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 25 May 2016 14:58:39 +0000 (14:58 +0000)
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
gcc/c/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/noncompile/old-style-parm-3.c [new file with mode: 0644]

index d74423b816def07c2b1e357a8db05f9fe1612a8c..f3bb0e9d58a30c6f47a6b8ad9eb6d9599eb01164 100644 (file)
@@ -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  <cesar@codesourcery.com>
 
        * c-parser.c (c_parser_oacc_declare): Add support for
index d7c3783d9898124d61f0a2594619fc6358cdbad2..d79802ee72c39f9ca866d5393e5750cb394858fd 100644 (file)
@@ -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))
index c1a5372bb7a442ce7a8764cf19bdfd0f308fdbe6..1b1b97e2c73e32fe55b56e2ba12958265aa49903 100644 (file)
@@ -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  <nathan@acm.org>
 
        * 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 (file)
index 0000000..f9d6d0f
--- /dev/null
@@ -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" } */
+  };
+{
+}