[Bug c/76732] GCC should warn on repeated initializer for same array element / struct member.
rusty at rustcorp dot com.au
gcc-bugzilla@gcc.gnu.org
Wed Aug 17 02:00:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=76732
--- Comment #6 from rusty at rustcorp dot com.au ---
"manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> writes:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=76732
>
> Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |manu at gcc dot gnu.org
>
> --- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
> GCC already warns for this (for C)
>
> test.c:1:32: warning: initialized field overwritten [-Woverride-init]
> int x[] = { [0] = 1, +3, [1] = 1 };
Ah, thanks!
Surprised -Wall doesn't set -Woverride-init then; presume this was a
conscious decision?
I'll add it to my CFLAGS.
Thanks again!
Rusty.
More information about the Gcc-bugs
mailing list