https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114421
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- https://en.cppreference.com/w/cpp/language/memory_model#Forward_progress is a decent reference when it comes to what it means by forward progress in C++. Note C and C++ have slightly different requirements. And C++17 has different from previous versions of C++ also. (In reply to Xi Ruoyao from comment #3) > In C++ there is no "the controlling expression is a constant expression" > exempt, so even while (true); can be optimized out. AFAIK GCC does not > optimize away while (true); in C++, but Clang is actively doing this. There > is a WG21 paper to add the constant expression exemption for C++ like C (I > cannot remember its Nxxxx ID though). https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2809r0.html is the paper about C++'s `while(true);`