How do I disable tailcall optimizations in gcc

前端 未结 2 624
无人共我
无人共我 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: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.

提交回复
热议问题