This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

tail calls in const functions?


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]