]> gcc.gnu.org Git - gcc.git/commitdiff
* varasm.c (output_constructor): Handle RANGE_EXPR in array index.
authorPer Bothner <bothner@gcc.gnu.org>
Wed, 5 Jun 1996 19:55:01 +0000 (12:55 -0700)
committerPer Bothner <bothner@gcc.gnu.org>
Wed, 5 Jun 1996 19:55:01 +0000 (12:55 -0700)
From-SVN: r12165

gcc/varasm.c

index 31045fca19dfd6cfe0ec4640d009f3bf1b76151f..08399f2279497cb6280d0a5d41b0636963e1a08d 100644 (file)
@@ -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.  */
 
This page took 0.062227 seconds and 5 git commands to generate.