https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108808
--- Comment #3 from Zhihan Yue <zhihan.yue at foxmail dot com> --- (In reply to Andrew Pinski from comment #1) > >This shows that the infinite loop was skipped. > > > Correct. There is a requirement in the C++17 standard that requires forward > process and therefor infinite loops can be removed. > > > "The implementation may assume that any thread will eventually do one of > the following: > — terminate, > — make a call to a library I/O function, > — perform an access through a volatile glvalue, or > — perform a synchronization operation or an atomic operation. > [Note: This is intended to allow compiler transformations such as > removal of empty loops, even when termination cannot be proven. — end note]" I get it! Thank you for your explanation.