Commit 1a6603da by Richard Stallman

(grokdeclarator): Error for div by 0 in array size.

From-SVN: r3753
parent d50c1d49
...@@ -4087,7 +4087,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) ...@@ -4087,7 +4087,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
else else
{ {
if (pedantic) 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, itype = build_binary_op (MINUS_EXPR, size, integer_one_node,
1); 1);
/* Make sure the array size remains visibly nonconstant /* Make sure the array size remains visibly nonconstant
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment