public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/55874] New: Incorrect warning location for uninitialized variable
@ 2013-01-04 11:51 steven at gcc dot gnu.org
  2013-01-04 12:15 ` [Bug middle-end/55874] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: steven at gcc dot gnu.org @ 2013-01-04 11:51 UTC (permalink / raw)
  To: gcc-bugs


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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-10 10:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-04 11:51 [Bug middle-end/55874] New: Incorrect warning location for uninitialized variable steven at gcc dot gnu.org
2013-01-04 12:15 ` [Bug middle-end/55874] " rguenth at gcc dot gnu.org
2013-01-04 12:46 ` manu at gcc dot gnu.org
2014-03-10 10:54 ` manu at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).