From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20416 invoked by alias); 3 Feb 2015 15:47:47 -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 20295 invoked by uid 55); 3 Feb 2015 15:47:38 -0000 From: "joseph at codesourcery dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/64918] invalid (?) warning when initializing structure Date: Tue, 03 Feb 2015 15:47: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.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: joseph at codesourcery dot com X-Bugzilla-Status: UNCONFIRMED 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: 2015-02/txt/msg00224.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64918 --- Comment #1 from joseph at codesourcery dot com --- I think the logical side-effect in C standard terms of the initializer being overridden is that it contains a compound literal, and so executing that initializer has the side-effect of initializing that compound literal (compound literal initializers being executed each time the compound literal is reached in the order of execution). The warning is because it's unspecified whether overridden initializers are executed at all, and so whether their side-effects occur - but in this case it's maybe not so helpful, because the compound literal in the overridden initializer can't actually be accessed so it doesn't matter if the side-effect of initializing it gets lost (unless any of its initializers contained other side-effects, which they don't in this case).