tail calls in const functions?
Jan Hubicka
hubicka@atrey.karlin.mff.cuni.cz
Thu Mar 23 06:24:00 GMT 2000
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
More information about the Gcc
mailing list