* c-decl.c (grokdeclarator): Don't pedwarn variable sized arrays
for c99.
* gcc.dg/c90-vla-1.c, gcc.dg/c99-vla-1.c: New.
From-SVN: r52738
+2002-04-24 Richard Henderson <rth@redhat.com>
+
+ PR c/3467
+ * c-decl.c (grokdeclarator): Don't pedwarn variable sized arrays
+ for c99.
+
Wed Apr 24 21:51:54 2002 J"orn Rennecke <joern.rennecke@superh.com>
* sh.c (sh_va_arg): If argument was passed by reference,
even if it is (eg) a const variable with known value. */
size_varies = 1;
- if (pedantic)
+ if (!flag_isoc99 && pedantic)
{
if (TREE_CONSTANT (size))
pedwarn ("ISO C89 forbids array `%s' whose size can't be evaluated",
--- /dev/null
+/* Origin: PR 3467 */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
+
+void
+tdef (int n)
+{
+ typedef int A[n]; /* { dg-error "forbids variable-size array" } */
+ A a;
+ A *p;
+ p = &a;
+}
--- /dev/null
+/* Origin: PR 3467 */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+void
+tdef (int n)
+{
+ typedef int A[n]; /* { dg-bogus "forbids variable-size array" } */
+ A a;
+ A *p;
+ p = &a;
+}