public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/36446] unexplained warning in struct initialization
Date: Wed, 18 Apr 2012 13:28:00 -0000	[thread overview]
Message-ID: <bug-36446-4-7FVi2Xrov2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-36446-4@http.gcc.gnu.org/bugzilla/>

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.


  parent reply	other threads:[~2012-04-18 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-36446-4@http.gcc.gnu.org/bugzilla/>
2012-04-18 12:58 ` vadmium+gc at gmail dot com
2012-04-18 13:28 ` manu at gcc dot gnu.org [this message]
2012-04-18 13:40 ` manu at gcc dot gnu.org
2012-04-18 14:05 ` manu at gcc dot gnu.org
2014-06-09  9:41 ` mpolacek at gcc dot gnu.org
2014-06-09 20:37 ` mpolacek at gcc dot gnu.org
2008-06-05 21:59 [Bug c/36446] New: " geoffrey dot levand at am dot sony dot com
2008-06-05 22:00 ` [Bug c/36446] " pinskia at gcc dot gnu dot org
2008-06-05 22:02 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-36446-4-7FVi2Xrov2@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).