public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug regression/42145]  New: Incorrect "may be used uninitialized warning" for a very specific test case
@ 2009-11-22 14:42 colin at reactos dot org
  2009-11-22 14:44 ` [Bug regression/42145] " colin at reactos dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: colin at reactos dot org @ 2009-11-22 14:42 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug regression/42145] Incorrect "may be used uninitialized warning" for a very specific test case
  2009-11-22 14:42 [Bug regression/42145] New: Incorrect "may be used uninitialized warning" for a very specific test case colin at reactos dot org
  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
  2 siblings, 0 replies; 4+ messages in thread
From: colin at reactos dot org @ 2009-11-22 14:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from colin at reactos dot org  2009-11-22 14:44 -------
Created an attachment (id=19085)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19085&action=view)
The preprocessed test case


-- 


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


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

* [Bug regression/42145] Incorrect "may be used uninitialized warning" for a very specific test case
  2009-11-22 14:42 [Bug regression/42145] New: Incorrect "may be used uninitialized warning" for a very specific test case colin at reactos dot org
@ 2009-11-22 14:44 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: colin at reactos dot org @ 2009-11-22 14:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from colin at reactos dot org  2009-11-22 14:43 -------
Created an attachment (id=19084)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19084&action=view)
The test case


-- 


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


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

* [Bug regression/42145] Incorrect "may be used uninitialized warning" for a very specific test case
  2009-11-22 14:42 [Bug regression/42145] New: Incorrect "may be used uninitialized warning" for a very specific test case colin at reactos dot org
  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
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-12-30 16:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2009-12-30 16:59 -------
This would need conditional PHIs, so a duplicate of PR20968.

GCC never detects that ret is always initialized, it doesn't warn because at
low optimization levels we do not warn for PHIs or because CCP (PR18501) just
initializes the variable (probably to 1 or 10). There is some differences
between the dumps of -O1 and -O2 in the way the logical or is transformed int
bitwise-or and how dom1 deals with each of them, but I cannot tell if there is
some missing optimization involved.

*** This bug has been marked as a duplicate of 20968 ***


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2009-12-30 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-22 14:42 [Bug regression/42145] New: Incorrect "may be used uninitialized warning" for a very specific test case colin at reactos dot org
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

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