Can I force gcc not to optimize calling to leaf functions with `-O2' option?

Ian Lance Taylor iant@google.com
Sat Mar 29 22:57:00 GMT 2008


"PRC" <panruochen@gmail.com> writes:

> I wonder if I can inform gcc not to optimize calling to leaf functions.

What you describe is not an optimization of calling leaf functions,
it's an optimization when the last action a function takes is to call
another function.  There are a couple of names for this optimization.
gcc calls it a sibling call.  The option to turn it off is
-fno-optimize-sibling-calls.

Ian



More information about the Gcc-help mailing list