[Bug middle-end/63943] wrong location for -Wmaybe-uninitialized in inlined function

vincent-gcc at vinc17 dot net gcc-bugzilla@gcc.gnu.org
Fri Aug 25 13:25:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63943

Vincent Lefèvre <vincent-gcc at vinc17 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent-gcc at vinc17 dot net

--- Comment #2 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
Another test case:

int foo (void)
{
  int i = 0, t;

  if (i > 0)
    t = i;

  if (t != 0)
    return 1;

  return 0;
}

int main (void)
{
  return foo () + foo () + foo () + foo ();
}

With -O1, I get 1 warning for foo and 1 for main.
With -O2, I get 1 warning for foo and 4 for main.

The warnings for main disappear if I add __attribute__((noinline)) on foo.
Surprisingly, they also disappear if I just remove the code related to variable
i.

Tested with:
gcc (Debian 20170823-1) 8.0.0 20170823 (experimental) [trunk revision 251306]


More information about the Gcc-bugs mailing list