tail calls in const functions?

Richard Henderson rth@cygnus.com
Fri Mar 24 02:22:00 GMT 2000


On Thu, Mar 23, 2000 at 03:24:31PM +0100, Jan Hubicka wrote:
> The tail call optimization makes function to modify the stack, that
> belongs to the caller.  Is this valid for const function?

It doesn't belong to the caller.  Not any more than
call-clobbered registers do.

> 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

I don't agree.


r~


More information about the Gcc mailing list