OSDN Git Service

(output_init_element): When adding to constructor_pending_elts, copy field.
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Sep 1993 10:36:19 +0000 (10:36 +0000)
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Sep 1993 10:36:19 +0000 (10:36 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@5281 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/c-typeck.c

index 40207c4..db66823 100644 (file)
@@ -5822,8 +5822,10 @@ output_init_element (value, type, field, pending)
       && !tree_int_cst_equal (field, constructor_unfilled_index))
     {
       if (! duplicate)
+       /* The copy_node is needed in case field is actually
+          constructor_index, which is modified in place.  */
        constructor_pending_elts
-         = tree_cons (field,
+         = tree_cons (copy_node (field),
                       digest_init (type, value, 0, 0),
                       constructor_pending_elts);
     }