Potential fix for PR24374

Kean Johnston jkj@sco.com
Sat Oct 15 23:40:00 GMT 2005


> That's also bad.  There is no reason to modify generic code,
> targets have already a hook to disable tail call optimization.
> Look at ix86_function_ok_for_sibcall.
I tried that first. I couldn't figure out how to get
MAIN_NAME_P to correctly identity main from the argument
to that function. If you could tell me how to do that,
I'll happily change it. But it seems less invasive to
me to have the conditionally compiled code like it is
in calls.c than to have to change (if more than one
target finds it needs this set) many different target
hook functions.

> Also, only -m32 compiled code adjusts stack in main, so please
> don't impose that limitation on x86_64 code.
This doesn't control adjusting the stack, it only controls
sibling call optimization for main. The only "penalty" you
will pay is if you have code like:

int main1(void) {}

int main(void) { return main1();}

That you will get an actual call to main1. And *only* in
the case of main. Thats a pretty miniscule "limitation"
on x86_64 code.

Kean



More information about the Gcc-patches mailing list