Bug 1029448 - option -Wmissing-field-initializers does not work
option -Wmissing-field-initializers does not work
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-11-12 07:10 EST by Jorge Stolfi
Modified: 2015-02-13 01:47 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-02-13 01:47:09 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
source code that exhibits the bug (218 bytes, text/plain)
2013-11-12 07:10 EST, Jorge Stolfi
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 39589 None None None Never

  None (edit)
Description Jorge Stolfi 2013-11-12 07:10:50 EST
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:
Comment 1 Marek Polacek 2015-02-12 09:21:38 EST
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
Comment 2 Marek Polacek 2015-02-13 01:47:09 EST
Tracking upstream then.

Note You need to log in before you can comment on or make changes to this bug.