How do I disable tailcall optimizations in gcc

前端 未结 2 617
无人共我
无人共我 2020-12-16 16:12

Wondering if anyone knows the flag for gcc to disable tailcall optimizations. Basically in a tailcall optimization, gcc will replace a stack frame when the return value fro

相关标签:
2条回答
  • 2020-12-16 16:46

    Untested: -fno-optimize-sibling-calls

    http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

    0 讨论(0)
  • 2020-12-16 16:48

    GCC manual:

       -foptimize-sibling-calls
           Optimize sibling and tail recursive calls.
    
           Enabled at levels -O2, -O3, -Os.
    

    So either compile with -O0/-O1, or use -fno-optimize-sibling-calls.

    0 讨论(0)
提交回复
热议问题