From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17302 invoked by alias); 24 Oct 2012 22:17:01 -0000 Received: (qmail 17150 invoked by uid 48); 24 Oct 2012 22:16:26 -0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/18501] [4.6/4.7/4.8 Regression] Missing 'used uninitialized' warning (CCP) Date: Wed, 24 Oct 2012 22:17:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: minor X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: REOPENED X-Bugzilla-Priority: P5 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.4 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: 2012-10/txt/msg02270.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D18501 --- Comment #57 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez 2012-10-24 22:16:09 UTC --- BTW, Clang has decided to implement this in the FE for simple cases. Quoting: http://clang.llvm.org/docs/ReleaseNotes.html -Wuninitialized has been taught to recognise uninitialized uses which always occur when an explicitly-written non-constant condition is either true or false. For example: int f(bool b) { int n; if (b) n =3D 1; return n; } sometimes-uninit.cpp:3:7: warning: variable 'n' is used uninitialized whene= ver 'if' condition is false [-Wsometimes-uninitialized] if (b) ^ sometimes-uninit.cpp:5:10: note: uninitialized use occurs here return n; ^ sometimes-uninit.cpp:3:3: note: remove the 'if' if its condition is always = true if (b) ^~~~~~ sometimes-uninit.cpp:2:8: note: initialize the variable 'n' to silence this warning int n; ^ =3D 0