aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-decl.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/vla-25.c9
4 files changed, 23 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index c04443e..3ea177f 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2019-12-03 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/88704
+ * c-decl.c (store_parm_decls_oldstyle): Diagnose use of [*] in
+ old-style parameter definitions.
+
2019-12-01 Sandra Loosemore <sandra@codesourcery.com>
PR target/92499
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index bf1857d..0450fcd 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -9394,6 +9394,9 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
"old-style function definition");
}
+ if (current_scope->had_vla_unspec)
+ error ("%<[*]%> not allowed in other than function prototype scope");
+
/* Match each formal parameter name with its declaration. Save each
decl in the appropriate TREE_PURPOSE slot of the parmids chain. */
for (parm = parmids; parm; parm = TREE_CHAIN (parm))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d5c7b0d..915c062 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-03 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/88704
+ * gcc.dg/vla-25.c: New test.
+
2019-12-03 Jakub Jelinek <jakub@redhat.com>
* g++.dg/lto/inline-crossmodule-1_0.C: Use -fdump-ipa-inline-details
diff --git a/gcc/testsuite/gcc.dg/vla-25.c b/gcc/testsuite/gcc.dg/vla-25.c
new file mode 100644
index 0000000..f604157
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vla-25.c
@@ -0,0 +1,9 @@
+/* Test [*] diagnosed on old-style parameter declaration. PR c/88704. */
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -pedantic-errors" } */
+
+void
+f (x)
+ int x[*];
+{ /* { dg-error "not allowed in other than function prototype scope" } */
+}