This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Can I force gcc not to optimize calling to leaf functions with `-O2' option?
- From: Ian Lance Taylor <iant at google dot com>
- To: "PRC" <panruochen at gmail dot com>
- Cc: "gcc-help" <gcc-help at gcc dot gnu dot org>
- Date: Sat, 29 Mar 2008 15:57:22 -0700
- Subject: Re: Can I force gcc not to optimize calling to leaf functions with `-O2' option?
- References: <200803291611208655796@gmail.com>
"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