From 7542c3b4f55405242706be8bc0deea4d41c270c4 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 5 Sep 2011 09:03:08 +0000 Subject: [PATCH] 2011-09-05 Richard Guenther * 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 --- gcc/ChangeLog | 5 +++++ gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c-common.c | 2 +- gcc/stor-layout.c | 13 ++++++------- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5a9a33989c9..ab05faa1d03 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-09-05 Richard Guenther + + * stor-layout.c (layout_type): Use size_binop for array size + calculations. + 2011-09-05 Georg-Johann Lay * config/avr/avr.h (progmem_section): Remove Declaration. diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 44eae081011..95abde6b7fc 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2011-09-05 Richard Guenther + + * c-common.c (complete_array_type): Use ssize_int (-1) instead + of integer_minus_one_node for empty array upper bounds. + 2011-08-28 Dodji Seketeli * c-pch.c (c_common_read_pch): Call linemap_add with LC_ENTER as diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 4cace8d3b14..9c42d5944da 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -8844,7 +8844,7 @@ complete_array_type (tree *ptype, tree initial_value, bool do_default) { if (pedantic) failure = 3; - maxindex = integer_minus_one_node; + maxindex = ssize_int (-1); } else { 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, -- 2.11.4.GIT