This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug regression/42145] New: Incorrect "may be used uninitialized warning" for a very specific test case


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]