This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/55874] New: Incorrect warning location for uninitialized variable
- From: "steven at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 04 Jan 2013 11:51:26 +0000
- Subject: [Bug middle-end/55874] New: Incorrect warning location for uninitialized variable
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55874
Bug #: 55874
Summary: Incorrect warning location for uninitialized variable
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: steven@gcc.gnu.org
$ cat t.c
void bar (void);
int foo (int b, int c, int d)
{
int res, r = 0;
if (b)
res = b * 2 + 4;
if (c)
{
if (d)
r = res;
else
__builtin_unreachable ();
}
return r;
}
$ ./xgcc -B. -O2 -W -Wall -Wextra t.c
t.c: In function 'foo':
t.c:14:3: warning: 'res' may be used uninitialized in this function
[-Wmaybe-uninitialized]
return r;
^
$
The warning is correct, but I'd expect the caret to point to res, not to
the return statement.