(grokdeclarator): Use signed version of `sizetype' for type of array
authorRichard Kenner <kenner@gcc.gnu.org>
Sat, 19 Mar 1994 11:29:25 +0000 (06:29 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Sat, 19 Mar 1994 11:29:25 +0000 (06:29 -0500)
index.

From-SVN: r6822

gcc/c-decl.c

index 7e07932..a95e725 100644 (file)
@@ -4220,6 +4220,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
          register tree size = TREE_OPERAND (declarator, 1);
          /* An uninitialized decl with `extern' is a reference.  */
          int extern_ref = !initialized && (specbits & (1 << (int) RID_EXTERN));
+         /* The index is a signed object `sizetype' bits wide.  */
+         tree index_type = signed_type (sizetype);
 
          declarator = TREE_OPERAND (declarator, 0);
 
@@ -4292,10 +4294,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
                    }
                }
 
-             /* Convert size to sizetype, so that if it is a variable
+             /* Convert size to index_type, so that if it is a variable
                 the computations will be done in the proper mode.  */
-             itype = fold (build (MINUS_EXPR, sizetype,
-                                  convert (sizetype, size), size_one_node));
+             itype = fold (build (MINUS_EXPR, index_type,
+                                  convert (index_type, size),
+                                  convert (index_type, size_one_node)));
 
              if (size_varies)
                itype = variable_size (itype);