This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/64918] invalid (?) warning when initializing structure
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Feb 2015 15:47:37 +0000
- Subject: [Bug c/64918] invalid (?) warning when initializing structure
- Auto-submitted: auto-generated
- References: <bug-64918-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64918
--- Comment #1 from joseph at codesourcery dot com <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).