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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #6)
> (In reply to Jakub Jelinek from comment #5)
> > Created attachment 54412 [details]
> > gcc13-pr108656.patch
> > 
> > So shall we fix it like this then?
> 
> But isn't this the wrong "side"?  returns_twice means it is the abnormal
> control _receiver_, it doesn't perform an abnormal goto itself.
> 
> stmt_starts_bb_p is correct here, so where does it go wrong?

I think it needs both.  The thing is, when it returns the second time, it does
that again by returning from itself, not through returning from some unrelated
function.
Say, if we have pure + returns_twice call and no other call in a function, the
abnormal edge to the pure + returns_twice call would be optimized away, even
when the call remains, because there would be no edge from some call to the
.ABNORMAL_DISPATCHER block.
__attribute__((pure, returns_twice)) int foo (void);

int
bar (void)
{
  for (int i = 0; i < 64; ++i)
    {
      int x = foo ();
      if (x == 26)
        return -42;
    }
  return 42;
}
doesn't even have because of this any abnormal edges created.
Or, if there is some other non-pure call somewhere else, we model through the
abnormal
edges that that other call can pass control back to the start of the
returns_twice call to make it return again.

Reply via email to