OSDN Git Service

* stor-layout.c (layout_type, case ARRAY_TYPE): Add missing code to
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 14 Apr 2003 21:36:35 +0000 (21:36 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 14 Apr 2003 21:36:35 +0000 (21:36 +0000)
handle "superflat arrays" in Ada.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65595 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/stor-layout.c

index 8b0dafc..daec312 100644 (file)
@@ -1,5 +1,8 @@
 2003-04-14  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
+       * stor-layout.c (layout_type, case ARRAY_TYPE): Add missing code to
+       handle "superflat arrays" in Ada.
+
        * integrate.c (expand_inline_function): Don't inline if would
        lose /u on a BLKmode TARGET.
 
index c592fa4..7ebdda8 100644 (file)
@@ -1740,6 +1740,15 @@ layout_type (type)
                  element_size = integer_one_node;
              }
 
+           /* If neither bound is a constant and sizetype is signed, make
+              sure the size is never negative.  We should really do this
+              if *either* bound is non-constant, but this is the best
+              compromise between C and Ada.  */
+           if (! TREE_UNSIGNED (sizetype)
+               && TREE_CODE (TYPE_MIN_VALUE (index)) != INTEGER_CST
+               && TREE_CODE (TYPE_MAX_VALUE (index)) != INTEGER_CST)
+             length = size_binop (MAX_EXPR, length, size_zero_node);
+
            TYPE_SIZE (type) = size_binop (MULT_EXPR, element_size,
                                           convert (bitsizetype, length));