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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> (In reply to Jakub Jelinek from comment #1)
> > The PR119376 patch ought to handle this (for musttail only of course,
> > otherwise unless we can prove it escaped but isn't observable by the
> > potential tail call callee, we can't do a tail call).
> 
> So looking into the history of this code. The original testcase which would
> fail due to this has a tail call now and works.

Well not exactly has a tail call but is marked for tail call and then is
correctly rejected while doing the expansion.

Original (updated) testcase (but I don't see this added to the testsuite
either):
```
struct foo { int a,b,c; };
__attribute__((noinline))
void
brother (int a, int b)
{
  if (a)
    __builtin_abort ();
}

__attribute__((noinline))
void
sister (struct foo f, int b)
{
  int *tmp = &f.b;

 // [[clang::musttail]]
  return brother (tmp[0] == b, b);
}
int
main (void)
{
  struct foo f = { 7,8,9};
  sister (f, 1);
  return 0;
}
```

Reply via email to