public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincent-gcc at vinc17 dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/59223] New: -Wmaybe-uninitialized and -Wuninitialized relationships
Date: Thu, 21 Nov 2013 02:42:00 -0000	[thread overview]
Message-ID: <bug-59223-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2013-11-21  2:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21  2:42 vincent-gcc at vinc17 dot net [this message]
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

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-59223-4@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).