diff options
author | Richard Henderson <rth@cygnus.com> | 1998-02-10 16:43:32 -0800 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1998-02-10 17:43:32 -0700 |
commit | a2d53b285d44f774b3cf892baa69c4a40e60164f (patch) | |
tree | b629be67cbc722b0c66b67afcdde374b5c32e9d3 | |
parent | 381127e8451026b670f2dc47e7cacf437b372795 (diff) | |
download | gcc-a2d53b285d44f774b3cf892baa69c4a40e60164f.zip gcc-a2d53b285d44f774b3cf892baa69c4a40e60164f.tar.gz gcc-a2d53b285d44f774b3cf892baa69c4a40e60164f.tar.bz2 |
stor-layout.c (layout_type): Do upper - lower in the native type, so as to properly handle negative indices.
* stor-layout.c (layout_type): Do upper - lower in the native type,
so as to properly handle negative indices.
From-SVN: r17846
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/stor-layout.c | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec4b15c..17e7c76 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Wed Feb 11 01:44:13 1998 Richard Henderson <rth@cygnus.com> + + * stor-layout.c (layout_type): Do upper - lower in the native type, + so as to properly handle negative indices. + Wed Feb 11 01:35:55 1998 Robert Lipe <robertl@dgii.com> * except.c (start_dynamic_cleanup): Remove unused variable 'dhc'. diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 0e4e508..491af0f 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -786,8 +786,11 @@ layout_type (type) lb, 0)) ub = TREE_OPERAND (ub, 0); + /* The initial subtraction should happen in the original type so + that (possible) negative values are handled appropriately. */ length = size_binop (PLUS_EXPR, size_one_node, - size_binop (MINUS_EXPR, ub, lb)); + fold (build (MINUS_EXPR, TREE_TYPE (lb), + ub, lb))); /* If neither bound is a constant and sizetype is signed, make sure the size is never negative. We should really do this |