From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1922 invoked by alias); 10 Apr 2014 20:43:08 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 1899 invoked by uid 48); 10 Apr 2014 20:43:04 -0000 From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/60784] Spurious -Wmissing-field-initializers warning for anonymous structure Date: Thu, 10 Apr 2014 20:43:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg00762.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60784 --- Comment #3 from Marek Polacek --- 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)