re PR c/89045 (ICE in get_parm_info, at c/c-decl.c:7518)
authorJakub Jelinek <jakub@redhat.com>
Mon, 28 Jan 2019 23:49:51 +0000 (00:49 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 28 Jan 2019 23:49:51 +0000 (00:49 +0100)
PR c/89045
* c-decl.c (build_compound_literal): Don't pushdecl if in parameter
scope.

* gcc.dg/pr89045.c: New test.

From-SVN: r268349

gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr89045.c [new file with mode: 0644]

index e6bff9c064b48d344c2cc539eb692ebf8ea39ff3..dcb3f2136d996220f872dd74ce92d0c7e7f2c90e 100644 (file)
@@ -1,5 +1,9 @@
 2019-01-29  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c/89045
+       * c-decl.c (build_compound_literal): Don't pushdecl if in parameter
+       scope.
+
        PR c/86125
        * c-decl.c (last_fileptr_type): Remove.
        (last_structptr_types): New variable.
index 593b34e00470678bb35e8aaf02a1953742daeda2..02a93231130f059b001571f7fbc74c75149a3868 100644 (file)
@@ -5528,7 +5528,7 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const,
       pushdecl (decl);
       rest_of_decl_compilation (decl, 1, 0);
     }
-  else if (current_function_decl)
+  else if (current_function_decl && !current_scope->parm_flag)
     pushdecl (decl);
 
   if (non_const)
index 2e97ef3ae463b01005280b14c9e7462b3cda3b93..9798783152e588b21460053367d2ae21baa17c63 100644 (file)
@@ -1,5 +1,8 @@
 2019-01-29  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c/89045
+       * gcc.dg/pr89045.c: New test.
+
        PR c/86125
        * gcc.dg/Wbuiltin-declaration-mismatch-7.c: Guard testcase for
        lp64, ilp32 and llp64 only.
diff --git a/gcc/testsuite/gcc.dg/pr89045.c b/gcc/testsuite/gcc.dg/pr89045.c
new file mode 100644 (file)
index 0000000..d8ba65b
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR c/89045 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int
+foo (int x)
+{
+  int v[(int){ x }];
+  v[0] = 0;
+  int bar (int p[(int){ x }])
+  {
+    return p[0];
+  }
+  return bar (v);
+}