From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24092 invoked by alias); 22 Nov 2009 14:42:34 -0000 Received: (qmail 24078 invoked by uid 48); 22 Nov 2009 14:42:21 -0000 Date: Sun, 22 Nov 2009 14:42:00 -0000 Subject: [Bug regression/42145] New: Incorrect "may be used uninitialized warning" for a very specific test case X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "colin at reactos dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-11/txt/msg01851.txt.bz2 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