(pop_init_level): Correct typo in use of tree_int_cst_sgn.
authorJim Wilson <wilson@gcc.gnu.org>
Fri, 1 Apr 1994 00:53:32 +0000 (16:53 -0800)
committerJim Wilson <wilson@gcc.gnu.org>
Fri, 1 Apr 1994 00:53:32 +0000 (16:53 -0800)
From-SVN: r6934

gcc/c-typeck.c

index 179c1439a10c2c108a7cca4b6f8464922f7aea14..462a6aa5077e777abd40528431ae5643a2d7428b 100644 (file)
@@ -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);