(output_init_element): When adding to constructor_pending_elts, copy field.
authorRichard Stallman <rms@gnu.org>
Wed, 8 Sep 1993 10:36:19 +0000 (10:36 +0000)
committerRichard Stallman <rms@gnu.org>
Wed, 8 Sep 1993 10:36:19 +0000 (10:36 +0000)
From-SVN: r5281

gcc/c-typeck.c

index 40207c4404e120d6e561517861abce5588088a10..db66823719c317488a486fc9e6a47fd4cd391bb7 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);
     }