Hide Forgot
Created attachment 822887 [details] source code that exhibits the bug Description of problem: The gcc compiler option "-Wmissing-field-initializers" appears to have no effect, and is not flagged as invalid option. Version-Release number of selected component (if applicable): gcc (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8) How reproducible: 100% Steps to Reproduce: Compile the attached C source with gcc -Wmissing-field-initializers missing-fields.c The program defines a struct type with three fields, declares a variable of that type, assigns it a constructor that is missing one of the fields. Actual results: gcc -Wmissing-field-initializers missing-fields.c Compilation finished at Tue Nov 12 10:09:14 Expected results: According to the gcc 4.7.2 info file, the omission should have been flagged. Additional info:
That is intentional, even the gcc manual says This option does not warn about designated initializers, so the following modification does not trigger a warning: struct s { int f, g, h; }; struct s x = { .f = 3, .g = 4 }; But there's an upstream RFE for what you want: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39589
Tracking upstream then.