Are compilers allowed to remove infinite loops like Intel C++ Compiler with -O2 does?

后端 未结 7 1083
[愿得一人]
[愿得一人] 2021-01-04 12:31

The following testing code does correctly in VS either with debug or release, and also in GCC. It also does correctly for ICC with debug, but not when optimization enabled (

7条回答
  •  [愿得一人]
    2021-01-04 13:08

    As a slight aside, this version of icc does what you want. That is, it never calls doSomething().

    [9:41am][wlynch@computer /tmp] icc --version
    icc (ICC) 11.0 20081105
    

提交回复
热议问题