summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-05 09:03:08 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-05 09:03:08 +0000
commit7542c3b4f55405242706be8bc0deea4d41c270c4 (patch)
treeea45e4b0b22441a465d4935a39d510d54d5b860a /gcc/stor-layout.c
parentc3f18f18fb19e4a49fddfa98834d34dd5509cc46 (diff)
downloadgcc-7542c3b4f55405242706be8bc0deea4d41c270c4.tar.gz
2011-09-05 Richard Guenther <rguenther@suse.de>
* stor-layout.c (layout_type): Use size_binop for array size calculations. c-family/ * c-common.c (complete_array_type): Use ssize_int (-1) instead of integer_minus_one_node for empty array upper bounds. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178526 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index f15da0ce30f..359541e02df 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1959,16 +1959,15 @@ layout_type (tree type)
if (integer_zerop (element_size))
length = size_zero_node;
- /* The computation should happen in the original type so
- that (possible) negative values are handled appropriately. */
+ /* The computation should happen in the original signedness so
+ that (possible) negative values are handled appropriately
+ when determining overflow. */
else
length
= fold_convert (sizetype,
- fold_build2 (PLUS_EXPR, TREE_TYPE (lb),
- build_int_cst (TREE_TYPE (lb), 1),
- fold_build2 (MINUS_EXPR,
- TREE_TYPE (lb),
- ub, lb)));
+ size_binop (PLUS_EXPR,
+ build_int_cst (TREE_TYPE (lb), 1),
+ size_binop (MINUS_EXPR, ub, lb)));
TYPE_SIZE (type) = size_binop (MULT_EXPR, element_size,
fold_convert (bitsizetype,