forcing tail/sibling call optimization
Hans-Peter Nilsson
hp@bitrange.com
Wed Sep 25 18:41:00 GMT 2002
On Wed, 25 Sep 2002, Jonathan Lennox wrote:
> Fergus Henderson writes:
> > I did attempt to test the exact patch that I posted in the ways that
> > I described, but the GCC tests passed anyway (none of them test that
> > sibcall optimization is applied, apparently)
>
> Can DejaGNU set RLIMIT_STACK? If so, checking that sibcall optimization is
> working should be easy, I'd think -- just write a tail-recursive program
> that'll use up all the stack without it.
Please don't; it messes up testing. How about this instead:
have the recursive function call a function that saves an
address of a local variable. The recursive function does a few
more recursions, then calls the same or other function that
compares the "new" stack-level, which is supposedly the same if
tail-recursion works. Unfortunately this leaves out testing
sibcalls in leaf-functions. ;-) (Or less contradictory,
leaf-functions-except-the-sibcall.)
brgds, H-P
More information about the Gcc-patches
mailing list