diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1993-10-20 17:58:21 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1993-10-20 17:58:21 -0400 |
commit | 13b457e7e0d79ec4b1897fa270e06a209e3a9802 (patch) | |
tree | 1528a10c190ec8605a37c0082987ef584b45ef58 /gcc | |
parent | 7c314719ba9e1607b7638524184d1aad7fd85944 (diff) | |
download | gcc-13b457e7e0d79ec4b1897fa270e06a209e3a9802.zip gcc-13b457e7e0d79ec4b1897fa270e06a209e3a9802.tar.gz gcc-13b457e7e0d79ec4b1897fa270e06a209e3a9802.tar.bz2 |
(output_constructor): Add support for non-zero lower array bound.
From-SVN: r5836
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/varasm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 9026469..497d3a5 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -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) |