aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-09-08 10:36:19 +0000
committerRichard Stallman <rms@gnu.org>1993-09-08 10:36:19 +0000
commit8348547afcc43bea152a4890d85b3132ba6bfb3c (patch)
treeec4dd7259b2c0eeeb5cb0730d71b2aabed6148b8 /gcc
parent4b46230e9da6a7b397e17333700489f9933e6b9f (diff)
downloadgcc-8348547afcc43bea152a4890d85b3132ba6bfb3c.zip
gcc-8348547afcc43bea152a4890d85b3132ba6bfb3c.tar.gz
gcc-8348547afcc43bea152a4890d85b3132ba6bfb3c.tar.bz2
(output_init_element): When adding to constructor_pending_elts, copy field.
From-SVN: r5281
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-typeck.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 40207c4..db66823 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -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);
}