From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15371 invoked by alias); 12 Nov 2012 20:07:52 -0000 Received: (qmail 15260 invoked by uid 48); 12 Nov 2012 20:07:31 -0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55288] Improve handling/suppression of maybe-uninitialized warnings Date: Mon, 12 Nov 2012 20:07:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Last reconfirmed CC Ever Confirmed 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-11/txt/msg01052.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D55288 Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-11-12 CC| |manu at gcc dot gnu.org Ever Confirmed|0 |1 --- Comment #1 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez 2012-11-12 20:07:31 UTC --- Why don't just initialize the variable? It seems simpler than implementing = yet another special attribute in GCC. That said, I find strange that the warning points to somewhere within a function without telling the user where from that function was called. For = more complex testcases, this could turn out to be very confusing. Also, the loca= tion is not actually pointing to the variable but to ';'. Clang says: pr55288.cc:40:9: warning: variable 'q' may be uninitialized when used here [-Wconditional-uninitialized] foo(q); ^ pr55288.cc:22:8: note: initialize the variable 'q' to silence this warning int q; ^ =3D 0