[Bug c/60784] Spurious -Wmissing-field-initializers warning for anonymous structure

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 10 20:43:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60784

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This regtested/bootstrapped patch fixes it, but I'm not fully confident it's
the Right Place.  The problem is that constructor_designated wasn't set
properly when entering pop_init_level from c_parser_braced_init, since
push_init_level called earlier set it to 0.

diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 65aad45..9813698 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -7750,6 +7750,7 @@ set_init_label (tree fieldname, struct obstack *
braced_init_obstack)
     do
       {
        constructor_fields = TREE_VALUE (field);
+       constructor_designated = 1;
        designator_depth++;
        designator_erroneous = 0;
        if (constructor_range_stack)



More information about the Gcc-bugs mailing list