aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1994-03-31 16:53:32 -0800
committerJim Wilson <wilson@gcc.gnu.org>1994-03-31 16:53:32 -0800
commit45ce961e2ff1a75b7d9ad1e230a5daad7cddb2d1 (patch)
tree80d909748a0974452e8c8365bf6ed34b837873e2 /gcc
parent9b190d1c887a853a9c3a16ffd5f95e65c0576127 (diff)
downloadgcc-45ce961e2ff1a75b7d9ad1e230a5daad7cddb2d1.zip
gcc-45ce961e2ff1a75b7d9ad1e230a5daad7cddb2d1.tar.gz
gcc-45ce961e2ff1a75b7d9ad1e230a5daad7cddb2d1.tar.bz2
(pop_init_level): Correct typo in use of tree_int_cst_sgn.
From-SVN: r6934
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-typeck.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 179c143..462a6aa 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -5394,9 +5394,12 @@ pop_init_level (implicit)
TYPE_DOMAIN (constructor_type) = build_index_type (maxindex);
TREE_TYPE (maxindex) = TYPE_DOMAIN (constructor_type);
+ /* TYPE_MAX_VALUE is always one less than the number of elements
+ in the array, because we start counting at zero. Therefore,
+ warn only if the value is less than zero. */
if (pedantic
&& (tree_int_cst_sgn (TYPE_MAX_VALUE (TYPE_DOMAIN (constructor_type)))
- <= 0))
+ < 0))
error_with_decl (constructor_decl,
"zero or negative array size `%s'");
layout_type (constructor_type);