This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Why do call-clobbered local variables make the function not suitable for tail call optimization?
- From: Richard Henderson <rth at redhat dot com>
- To: Jie Zhang <zhangjie at magima dot com dot cn>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 20 Jul 2004 11:44:42 -0700
- Subject: Re: Why do call-clobbered local variables make the function not suitable for tail call optimization?
- References: <40FCD931.8000606@magima.com.cn>
On Tue, Jul 20, 2004 at 04:34:57PM +0800, Jie Zhang wrote:
> Can somebody give me a hint why call-clobbered local
> variables prevent the function from being tail call optimized?
int *global;
void f1(int *x)
{
global = x;
*x = 123;
}
int f2(void)
{
clobber_the_stack();
return *global;
}
int foo()
{
int x;
f1(&x);
return f2();
}
int main()
{
if (foo() != 123)
abort ();
return;
}
r~