[Bug c/47772] New: warnings from -Wmissing-field-initializers contradict documentation
darren at kulp dot ch
gcc-bugzilla@gcc.gnu.org
Wed Feb 16 20:49:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47772
Summary: warnings from -Wmissing-field-initializers contradict
documentation
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: darren@kulp.ch
Created attachment 23367
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23367
testcase re: -Wmissing-field-initializers and designated initializers
According to gcc(1):
-Wmissing-field-initializers
Warn if a structure's initializer has some fields missing. ... This
option does not warn about designated initializers ....
This I find normally to be true. Attached is a test case that produces the
following warning on GCC 4.2.1, 4.4.4., and 4.5.2:
$ gcc -save-temps -Wmissing-field-initializers -c test3.c
test3.c:14: warning: missing initializer
test3.c:14: warning: (near initialization for ‘(anonymous)[0].b’)
If the `b' field is initialized either before or after the `a' field, the
warning disappears, but this should not be necessary, according to the
documentation.
More information about the Gcc-bugs
mailing list