GCC, compare the effect of using -O2 and using all the optimization flags it turns on

前端 未结 2 1630
一个人的身影
一个人的身影 2021-01-22 01:21

From gcc5.4 documentation, it says

-O2 turns on all optimization flags specified by -O. It also turns on the following optimization flags:

-ft

2条回答
  •  忘掉有多难
    2021-01-22 01:33

    It is a common gotcha. In order to enable (or disable) specific optimizations, you must first enable the optimizer in general, i.e. use one of -O... flags, except -O0 (or just -O, which is equivalent to -O1).

提交回复
热议问题