stor-layout.c (layout_type): Use size_binop for array size calculations.

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.

From-SVN: r178526
This commit is contained in:
Richard Guenther 2011-09-05 09:03:08 +00:00 committed by Richard Biener
parent c149e48765
commit 830c740f17
4 changed files with 17 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2011-09-05 Richard Guenther <rguenther@suse.de>
* stor-layout.c (layout_type): Use size_binop for array size
calculations.
2011-09-05 Georg-Johann Lay <avr@gjlay.de> 2011-09-05 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr.h (progmem_section): Remove Declaration. * config/avr/avr.h (progmem_section): Remove Declaration.

View file

@ -1,3 +1,8 @@
2011-09-05 Richard Guenther <rguenther@suse.de>
* 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 <dodji@redhat.com> 2011-08-28 Dodji Seketeli <dodji@redhat.com>
* c-pch.c (c_common_read_pch): Call linemap_add with LC_ENTER as * c-pch.c (c_common_read_pch): Call linemap_add with LC_ENTER as

View file

@ -8844,7 +8844,7 @@ complete_array_type (tree *ptype, tree initial_value, bool do_default)
{ {
if (pedantic) if (pedantic)
failure = 3; failure = 3;
maxindex = integer_minus_one_node; maxindex = ssize_int (-1);
} }
else else
{ {

View file

@ -1959,16 +1959,15 @@ layout_type (tree type)
if (integer_zerop (element_size)) if (integer_zerop (element_size))
length = size_zero_node; length = size_zero_node;
/* The computation should happen in the original type so /* The computation should happen in the original signedness so
that (possible) negative values are handled appropriately. */ that (possible) negative values are handled appropriately
when determining overflow. */
else else
length length
= fold_convert (sizetype, = fold_convert (sizetype,
fold_build2 (PLUS_EXPR, TREE_TYPE (lb), size_binop (PLUS_EXPR,
build_int_cst (TREE_TYPE (lb), 1), build_int_cst (TREE_TYPE (lb), 1),
fold_build2 (MINUS_EXPR, size_binop (MINUS_EXPR, ub, lb)));
TREE_TYPE (lb),
ub, lb)));
TYPE_SIZE (type) = size_binop (MULT_EXPR, element_size, TYPE_SIZE (type) = size_binop (MULT_EXPR, element_size,
fold_convert (bitsizetype, fold_convert (bitsizetype,