public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/59223] New: -Wmaybe-uninitialized and -Wuninitialized relationships
@ 2013-11-21  2:42 vincent-gcc at vinc17 dot net
  2013-11-21  3:29 ` [Bug middle-end/59223] " manu at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2013-11-21  2:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59223
           Summary: -Wmaybe-uninitialized and -Wuninitialized
                    relationships
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent-gcc at vinc17 dot net

With:
* gcc-4.8 (Debian 4.8.2-5) 4.8.2
* gcc (Debian 20131021-1) 4.9.0 20131021 (experimental) [trunk revision 203899]

It seems that -Wmaybe-uninitialized works only if -Wuninitialized is enabled.
Moreover -Wmaybe-uninitialized is enabled by -Wuninitialized. I wonder whether
this is intended or something is missing in the man page (the gcc 4.8.2 one
doesn't say anything about these relationships).

xvii:~> cat tst2.c
int foo (int x)
{
  int y;
  if (x == 0)
    y = 1;
  else if (x == 1)
    y = 2;
  return y;
}

First test:

xvii:~> gcc-snapshot -O2 -Wmaybe-uninitialized -c tst2.c

No warning here; -Wuninitialized is needed to trigger the
[-Wmaybe-uninitialized] warning (see below).

Second test:

xvii:~> gcc-snapshot -O2 -Wuninitialized -c tst2.c
tst2.c: In function 'foo':
tst2.c:8:3: warning: 'y' may be used uninitialized in this function
[-Wmaybe-uninitialized]
   return y;
   ^

The use of -Wuninitialized alone has enabled -Wmaybe-uninitialized.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-27  8:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-21  2:42 [Bug middle-end/59223] New: -Wmaybe-uninitialized and -Wuninitialized relationships vincent-gcc at vinc17 dot net
2013-11-21  3:29 ` [Bug middle-end/59223] " manu at gcc dot gnu.org
2014-02-26 17:55 ` mpolacek at gcc dot gnu.org
2014-02-26 17:56 ` mpolacek at gcc dot gnu.org
2014-02-27  8:05 ` mpolacek at gcc dot gnu.org
2014-02-27  8:07 ` mpolacek at gcc dot gnu.org

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).