This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
tail calls in const functions?
- To: egcs at egcs dot cygnus dot com
- Subject: tail calls in const functions?
- From: Jan Hubicka <hubicka at atrey dot karlin dot mff dot cuni dot cz>
- Date: Thu, 23 Mar 2000 15:24:31 +0100
Hi
The tail call optimization makes function to modify the stack, that
belongs to the caller. Is this valid for const function?
IMO gcc has right to optimize out:
int test()
{
return c(1) + d(1);
}
the second store of 1, in case c is const function (it don't do that currently).
When tail call optimization is done for c, the stack is clobbered.
So perhaps it will be neccesary to disable tail call for const functions.
Honza