From: Richard Stallman Date: Wed, 20 Oct 1993 23:24:47 +0000 (+0000) Subject: (output_init_element): When initializing a union, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=76aaaae2a486d0da5251936f439a75879a626f92;p=gcc.git (output_init_element): When initializing a union, do it right away: never put the field on the pending list. From-SVN: r5844 --- diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 54cb60ce5d7..249311a0af0 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,