This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/64918] invalid (?) warning when initializing structure


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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]