This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: tail calls in const functions?
- To: Jan Hubicka <hubicka at atrey dot karlin dot mff dot cuni dot cz>
- Subject: Re: tail calls in const functions?
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 23 Mar 2000 15:32:28 +0100
- Cc: egcs at egcs dot cygnus dot com
- References: <20000323152431.C2277@atrey.karlin.mff.cuni.cz>
On Thu, Mar 23, 2000 at 03:24:31PM +0100, Jan Hubicka wrote:
> 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).
This is actually a wrong example, because none of these functions can be
a tail call (the parent routine has to sum the two returned values up).
Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.99-pre2 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________