This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/51740] New: warning "is used uninitialized in this function" is missing if the variable initialized later
- From: "szo at szo dot hu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 03 Jan 2012 14:28:21 +0000
- Subject: [Bug c/51740] New: warning "is used uninitialized in this function" is missing if the variable initialized later
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51740
Bug #: 51740
Summary: warning "is used uninitialized in this function" is
missing if the variable initialized later
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: szo@szo.hu
Created attachment 26231
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26231
Code that should warn
gcc fails to emit the "is used uninitialized in this function" warning, if the
offending variable is initialized via a function later on.
See attachment. If compiled with
gcc -Wall bug.c
gcc issues no warning. If line 13 is commented out, the correct
bug.c:11:9: warning: âoffenderâ is used uninitialized in this function
[-Wuninitialized]
is emitted.
I think it's not the same as #18501, because replacing line 13 with
offencer = 0;
still produces the warning correctly.