From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25626 invoked by alias); 8 Mar 2013 19:10:23 -0000 Received: (qmail 25375 invoked by uid 48); 8 Mar 2013 19:09:38 -0000 From: "mark.d.rustad at intel dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/56574] New: False possibly uninitialized variable warning Date: Fri, 08 Mar 2013 19:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mark.d.rustad at intel dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2013-03/txt/msg00708.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56574 Bug #: 56574 Summary: False possibly uninitialized variable warning Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: mark.d.rustad@intel.com The following code produces the warning,'value' may be used uninitialized: int get_value(void); void show_problem(int flag) { int value; if (!flag) value = get_value(); for (;;) { if (!flag && value) continue; if (!flag) break; } } The warning occurs only with -O1 and -O2 optimization. -O0 and -O3 and higher do not. It also occurs with many versions. I have gotten the same result with the following versions of gcc: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664) gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973] gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3) gcc (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5) Interestingly, the much larger function that originally displayed the problem does not generate a warning with the 4.7.0 compiler, but does on the others.