From 1a6603daede2865e5ffc12f493df87ff834cc292 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Tue, 16 Mar 1993 04:53:55 +0000 Subject: [PATCH] (grokdeclarator): Error for div by 0 in array size. From-SVN: r3753 --- gcc/c-decl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index e9b722dae09..80844596da8 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 -- 2.30.2