varasm.c (output_constructor): Use HOST_WIDE_INT for sizes.

* varasm.c (output_constructor): Use HOST_WIDE_INT for sizes.
	Only call array_size_for_constructor if last field and array type
	with no upper bound.

From-SVN: r38691
This commit is contained in:
Richard Kenner 2001-01-04 20:58:20 +00:00 committed by Richard Kenner
parent ceebdb0980
commit bf1aaf0ac6
2 changed files with 17 additions and 12 deletions

View File

@ -1,3 +1,9 @@
Thu Jan 4 15:54:05 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* varasm.c (output_constructor): Use HOST_WIDE_INT for sizes.
Only call array_size_for_constructor if last field and array type
with no upper bound.
2001-01-04 Philip Blundell <philb@gnu.org> 2001-01-04 Philip Blundell <philb@gnu.org>
* config/arm/arm.c (arm_gen_constant): Prefer to emit constants * config/arm/arm.c (arm_gen_constant): Prefer to emit constants

View File

@ -4549,7 +4549,7 @@ output_constructor (exp, size)
if (index && TREE_CODE (index) == RANGE_EXPR) if (index && TREE_CODE (index) == RANGE_EXPR)
{ {
register int fieldsize unsigned HOST_WIDE_INT fieldsize
= int_size_in_bytes (TREE_TYPE (type)); = int_size_in_bytes (TREE_TYPE (type));
HOST_WIDE_INT lo_index = tree_low_cst (TREE_OPERAND (index, 0), 0); HOST_WIDE_INT lo_index = tree_low_cst (TREE_OPERAND (index, 0), 0);
HOST_WIDE_INT hi_index = tree_low_cst (TREE_OPERAND (index, 1), 0); HOST_WIDE_INT hi_index = tree_low_cst (TREE_OPERAND (index, 1), 0);
@ -4571,7 +4571,7 @@ output_constructor (exp, size)
{ {
/* An element that is not a bit-field. */ /* An element that is not a bit-field. */
register int fieldsize; unsigned HOST_WIDE_INT fieldsize;
/* Since this structure is static, /* Since this structure is static,
we know the positions are constant. */ we know the positions are constant. */
HOST_WIDE_INT pos = field ? int_byte_position (field) : 0; HOST_WIDE_INT pos = field ? int_byte_position (field) : 0;
@ -4607,17 +4607,16 @@ output_constructor (exp, size)
/* Determine size this element should occupy. */ /* Determine size this element should occupy. */
if (field) if (field)
{ {
if (DECL_SIZE_UNIT (field) /* If the last field is an array with an unspecified upper
&& ! integer_zerop (DECL_SIZE_UNIT (field))) bound, the initializer determines the size. */
fieldsize = tree_low_cst (DECL_SIZE_UNIT (field), 1); if (TREE_CHAIN (field) == 0
else if (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE) && TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE
{ && TYPE_DOMAIN (TREE_TYPE (field)) != 0
/* If DECL_SIZE is not set or is zero, then this must be && TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (field))) == 0)
an array of unspecified length. The initialized value
must be a CONSTRUCTOR, and we take the length from the
last initialized element. */
fieldsize = array_size_for_constructor (val); fieldsize = array_size_for_constructor (val);
} else if (DECL_SIZE_UNIT (field)
&& host_integerp (DECL_SIZE_UNIT (field), 1))
fieldsize = tree_low_cst (DECL_SIZE_UNIT (field), 1);
else else
fieldsize = 0; fieldsize = 0;
} }