aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2003-04-14 21:36:35 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2003-04-14 17:36:35 -0400
commit0d3c880062c47315ef250bbf80291004a0eb0cb8 (patch)
treed86cbe78e722e036e7f5c050e4a0db9fb9ee428a /gcc/stor-layout.c
parent2443af37208590b754984ffd04b8ac19db5eff9f (diff)
downloadgcc-0d3c880062c47315ef250bbf80291004a0eb0cb8.zip
gcc-0d3c880062c47315ef250bbf80291004a0eb0cb8.tar.gz
gcc-0d3c880062c47315ef250bbf80291004a0eb0cb8.tar.bz2
stor-layout.c (layout_type, [...]): Add missing code to handle "superflat arrays" in Ada.
* stor-layout.c (layout_type, case ARRAY_TYPE): Add missing code to handle "superflat arrays" in Ada. From-SVN: r65595
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index c592fa4..7ebdda8 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -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));