Commit 13b457e7 by Richard Kenner

(output_constructor): Add support for non-zero lower array bound.

From-SVN: r5836
parent 7c314719
......@@ -3401,6 +3401,7 @@ output_constructor (exp, size)
int size;
{
register tree link, field = 0;
HOST_WIDE_INT min_index = 0;
/* Number of bytes output or skipped so far.
In other words, current position within the constructor. */
int total_bytes = 0;
......@@ -3414,6 +3415,10 @@ output_constructor (exp, size)
if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
field = TYPE_FIELDS (TREE_TYPE (exp));
if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
min_index
= TREE_INT_CST_LOW (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (exp))));
/* As LINK goes through the elements of the constant,
FIELD goes through the structure fields, if the constant is a structure.
if the constant is a union, then we override this,
......@@ -3457,7 +3462,7 @@ output_constructor (exp, size)
if (index != 0)
bitpos = (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (val)))
/ BITS_PER_UNIT
* TREE_INT_CST_LOW (index));
* (TREE_INT_CST_LOW (index) - min_index));
/* Output any buffered-up bit-fields preceding this element. */
if (byte_buffer_in_use)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment