public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "colin at reactos dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug regression/42145]  New: Incorrect "may be used uninitialized warning" for a very specific test case
Date: Sun, 22 Nov 2009 14:42:00 -0000	[thread overview]
Message-ID: <bug-42145-18346@http.gcc.gnu.org/bugzilla/> (raw)

I'm compiling the attached test case with "gcc version 4.5.0 20091018
(experimental) [trunk revision 152966] (Ubuntu 20091018-0ubuntu1)".
When using the command line "gcc -Wuninitialized -Os -o test test_gccbug.c",
I'm getting the following incorrect warning:

test_gccbug.c: In function 'main':
test_gccbug.c:17:6: warning: 'ret' may be used uninitialized in this function

Same happens with different builds of GCC 4.4.2, 4.4.1 and 4.3.4.
No such warning occurs with builds of GCC 4.2.4 and 4.1.3.

This problem does not occur if one or more of the following is done:
- You change the optimization level to -O0 or -O1 (-O2 and -O3 still trigger
the bug in this GCC 4.5.0 version, but not always in older versions I've
tested)
- You comment out line 10 of the test case
- You change line 22 of the test case to just 'if (!argc)'


-- 
           Summary: Incorrect "may be used uninitialized warning" for a very
                    specific test case
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: colin at reactos dot org


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


             reply	other threads:[~2009-11-22 14:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-22 14:42 colin at reactos dot org [this message]
2009-11-22 14:44 ` [Bug regression/42145] " colin at reactos dot org
2009-11-22 14:44 ` colin at reactos dot org
2009-12-30 16:59 ` manu 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-42145-18346@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).