summaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>1996-06-05 19:55:01 +0000
committerbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>1996-06-05 19:55:01 +0000
commit865c4b7a7d672b95cbad29363bcbda59c6d93e97 (patch)
tree6d5987e07d71de5a28f47a1b2281562da6892366 /gcc/varasm.c
parent640e960ce14db00d8f02b04cdf48dd470d6716f8 (diff)
downloadgcc-865c4b7a7d672b95cbad29363bcbda59c6d93e97.tar.gz
* varasm.c (output_constructor): Handle RANGE_EXPR in array index.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@12165 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 31045fca19d..08399f22794 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -3895,7 +3895,26 @@ output_constructor (exp, size)
if (val != 0)
STRIP_NOPS (val);
- if (field == 0 || !DECL_BIT_FIELD (field))
+ if (index && TREE_CODE (index) == RANGE_EXPR)
+ {
+ register int fieldsize
+ = int_size_in_bytes (TREE_TYPE (TREE_TYPE (exp)));
+ HOST_WIDE_INT lo_index = TREE_INT_CST_LOW (TREE_OPERAND (index, 0));
+ HOST_WIDE_INT hi_index = TREE_INT_CST_LOW (TREE_OPERAND (index, 1));
+ HOST_WIDE_INT index;
+ for (index = lo_index; index <= hi_index; index++)
+ {
+ /* Output the element's initial value. */
+ if (val == 0)
+ assemble_zeros (fieldsize);
+ else
+ output_constant (val, fieldsize);
+
+ /* Count its size. */
+ total_bytes += fieldsize;
+ }
+ }
+ else if (field == 0 || !DECL_BIT_FIELD (field))
{
/* An element that is not a bit-field. */