aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-03-16 04:53:55 +0000
committerRichard Stallman <rms@gnu.org>1993-03-16 04:53:55 +0000
commit1a6603daede2865e5ffc12f493df87ff834cc292 (patch)
treed7519e860d9ed15038ea330cbff0ad8284b1d624
parentd50c1d49cfa0861e9f1119390ee9a1de131500e2 (diff)
downloadgcc-1a6603daede2865e5ffc12f493df87ff834cc292.zip
gcc-1a6603daede2865e5ffc12f493df87ff834cc292.tar.gz
gcc-1a6603daede2865e5ffc12f493df87ff834cc292.tar.bz2
(grokdeclarator): Error for div by 0 in array size.
From-SVN: r3753
-rw-r--r--gcc/c-decl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index e9b722d..8084459 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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