From: Richard Henderson Date: Wed, 11 Feb 1998 00:38:24 +0000 (-0800) Subject: stor-layout.c (layout_type): Do upper - lower in the native type, so as to properly... X-Git-Tag: prereleases/egcs-1.0.2-prerelease~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a744ad84509016947c14de7d8b9f84b7213cdbe;p=thirdparty%2Fgcc.git 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: r17844 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1ada1fb3014e..1f8d2de1d254 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Wed Feb 11 01:39:47 1998 Richard Henderson + + * stor-layout.c (layout_type): Do upper - lower in the native type, + so as to properly handle negative indices. + Tue Feb 10 00:26:25 1998 Richard Kenner * rs6000.c (setup_incoming_varargs): Always set rs6000_sysv_varargs_p. diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 2ccf45ee1f4c..1ef998bfa835 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -777,8 +777,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