From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26802 invoked by alias); 7 Feb 2009 15:35:26 -0000 Received: (qmail 26729 invoked by uid 48); 7 Feb 2009 15:35:17 -0000 Date: Sat, 07 Feb 2009 15:35:00 -0000 Message-ID: <20090207153517.26728.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/22456] [4.2/4.3/4.4 regression] missing "is used uninitialized" warning In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "manu at gcc dot gnu 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-02/txt/msg00657.txt.bz2 ------- Comment #17 from manu at gcc dot gnu dot org 2009-02-07 15:35 ------- Without optimization we build the following: foo () { intD.0 iD.1591; # BLOCK 2 # PRED: ENTRY (fallthru) [pr22456.c : 4] goto ; # SUCC: 4 (fallthru) # BLOCK 3 # PRED: 4 (true) [pr22456.c : 4] iD.1591_3 = iD.1591_1 + 1; # SUCC: 4 (fallthru) # BLOCK 4 # PRED: 2 (fallthru) 3 (fallthru) # iD.1591_1 = PHI [pr22456.c : 4] if (iD.1591_1 != 0) goto ; else goto ; # SUCC: 3 (true) 5 (false) # BLOCK 5 # PRED: 4 (false) [pr22456.c : 5] return; # SUCC: EXIT } Because of the way the loop is represented, we generate a PHI node for the condition instead of a direct use. Since we do not warn about PHI nodes without optimization, then there is no warning. With optimization the loop is completely removed since it doesn't do anything. Hence, there is no warning. I wasn't able to construct a testcase where the loop does anything useful (or the value of "i" is used after the loop) and we do not warn. This doesn't have anything to do with CCP and it is not a duplicate of bug 18501. Closed as INVALID. If anyone comes up with a testcase for this where the loop is not empty, open a new PR and add me to the CC. -- manu at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- BugsThisDependsOn|18501 | Status|NEW |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22456