diff options
author | Richard Stallman <rms@gnu.org> | 1993-10-20 23:24:47 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1993-10-20 23:24:47 +0000 |
commit | 76aaaae2a486d0da5251936f439a75879a626f92 (patch) | |
tree | fd89481cc5c10d2b556546312a79a549e89ca5d1 | |
parent | 5d672cd7e639149aa1054481436a127420177d17 (diff) | |
download | gcc-76aaaae2a486d0da5251936f439a75879a626f92.zip gcc-76aaaae2a486d0da5251936f439a75879a626f92.tar.gz gcc-76aaaae2a486d0da5251936f439a75879a626f92.tar.bz2 |
(output_init_element): When initializing a union,
do it right away: never put the field on the pending list.
From-SVN: r5844
-rw-r--r-- | gcc/c-typeck.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 54cb60c..249311a 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -5518,10 +5518,12 @@ output_init_element (value, type, field, pending) digest_init (type, value, 0, 0), constructor_pending_elts); } - else if ((TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) + else if (TREE_CODE (constructor_type) == RECORD_TYPE && field != constructor_unfilled_fields) { + /* We do this for records but not for unions. In a union, + no matter which field is specified, it can be initialized + right away since it starts at the beginning of the union. */ if (!duplicate) constructor_pending_elts = tree_cons (field, |