(grokdeclarator): Error for div by 0 in array size.
authorRichard Stallman <rms@gnu.org>
Tue, 16 Mar 1993 04:53:55 +0000 (04:53 +0000)
committerRichard Stallman <rms@gnu.org>
Tue, 16 Mar 1993 04:53:55 +0000 (04:53 +0000)
From-SVN: r3753

gcc/c-decl.c

index e9b722dae09b6d5ac970d903c8357b88b1a4a524..80844596da8974f1470cf9941d173e4906588ab3 100644 (file)
@@ -4087,7 +4087,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
              else
                {
                  if (pedantic)
-                   pedwarn ("ANSI C forbids variable-size array `%s'", name);
+                   {
+                     if (TREE_CONSTANT (size))
+                       pedwarn ("ANSI C forbids array `%s' whose size can't be evaluated", name);
+                     else
+                       pedwarn ("ANSI C forbids variable-size array `%s'", name);
+                   }
                  itype = build_binary_op (MINUS_EXPR, size, integer_one_node,
                                           1);
                  /* Make sure the array size remains visibly nonconstant