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/36446] unexplained warning in struct initialization


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36446

Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-04-18
               Host|i386-redhat-linux           |
     Ever Confirmed|0                           |1

--- Comment #4 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2012-04-18 13:19:49 UTC ---
manuel@gcc12:~$ ~/trunk/186353/build/gcc/cc1 -Wextra pr36446.c
pr36446.c:13:3: warning: missing initializer [-Wmissing-field-initializers]
   .c = 2,
   ^
pr36446.c:13:3: warning: (near initialization for âm1.h.bâ)
[-Wmissing-field-initializers]
   .c = 2,
   ^

Apart from the warnings, there are several things wrong with this:

* The second message should use inform() and check the output of warning().

* The first message should say "missing initializer for field '.h.b'", and the
second should say "'struct h' defined here".

For comparison, this is what Clang prints when the warning is valid:

pr36446.c:12:10: warning: missing field 'b' initializer
[-Wmissing-field-initializers]
  .h = {1},
         ^
1 warning generated.


I don't think this bug is hard to fix, but unfortunately, I don't have time to
work on them. So if anyone here can help, this may get fixed for GCC 4.8. 

The first step is to launch gdb, find where the warning text is given, and put
a breakpoint at the call to warning(). Then figure out why the conditions for
warning are satisfied. Even if you cannot code a patch, this information would
be useful.


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