[Bug c++/108808] G++ -O2 incorrectly bypasses an infinite loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108808 --- Comment #3 from Zhihan Yue --- (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.
[Bug c++/108808] G++ -O2 incorrectly bypasses an infinite loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108808 --- Comment #2 from Andrew Pinski --- C++11 has "Implementations should ensure that all unblocked threads eventually make progress."
[Bug c++/108808] G++ -O2 incorrectly bypasses an infinite loop
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108808 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski --- >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]"