http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49519
--- Comment #30 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-07-12
08:42:40 UTC ---
> This patch seems too conservative and it appears that it will cause the
> compiler to miss all tailcalls with pointer arguments. It only matters if the
> register points to the incoming parameters, which can only happen in unusual
> cases. We should be able to determine that reliably.
This is a bit of an overstatement though, as
extern int foo (int, int *);
int i;
int bar (int a, int b)
{
int *p = &i;
return foo (a, p);
}
will be caught. Even this
extern int foo (int, int);
int i;
int bar (int a, int b)
{
int *p = &i;
return foo (a, *p);
}
will be caught thanks to alias analysis at the Tree level.
As for the "reliably", this time it's a little optimistic IMO. :-) But we can
probably be less conservative with more work.