[Bug c++/50276] [C++0x] Wrong "used uninitialized in this function" warning

paolo.carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 3 22:46:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50276

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-03 22:46:33 UTC ---
If I consider Comment #1, and maybe I tweak it a bit like this:

bool testfun(void*)
{
  return true;
}

template<int i>
bool test()
{
  if (bool value = /* true */ testfun( []() { return 0; } ))
    return value;

  __builtin_abort();

  return false;
}

int main()
{
  test<0>();
}

I see what looks like a full fledged miscompilation: testfun always returns
true, thus test should simply return true!  Jason, what do you think?



More information about the Gcc-bugs mailing list