[Bug c++/108808] G++ -O2 incorrectly bypasses an infinite loop
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 15 21:08:22 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108808
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>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]"
More information about the Gcc-bugs
mailing list