[Bug sanitizer/83219] [8 regression] c-c++-common/ubsan/unreachable-2.c fails starting with r255201

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 30 09:20:00 GMT 2017


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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
pass_sanopt it seems.  Quite late.  So how is this supposed to work?

The testcase is

int e;

int
main (void)
{
  return e ? 0 : (__builtin_unreachable (), 1);
}

and I bet that if we do

int e;

int
main (void)
{
  if (e)
   return e;
  __builtin_unreachable ();
}

we'd optimize it before with regular VRP.

Yes, we do.

So - why are __builtin_unreachable ()s not instrumented early?  They are,
after all, no longer "unreachable".


More information about the Gcc-bugs mailing list