https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114462
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I know, but I think this will need changes in the C++ FE. I was asking recently Jason what the "when interpreted as a constant-expression" in the paper actually means, whether such expression should be evaluated as manifestly constant evaluation or not. If yes, it seems like an incompatible change in a DR, because say #include <type_traits> void foo () { while (std::is_constant_evaluated ()) ; } changing behavior from previous doing nothing to an infinite loop. If it is not manifestly constant evaluation, still, the FE would need to (at least for the cases listed in the paper) try to silently constant evaluate the condition (with mce_false such that std::is_constant_evaluated () is folded to false in there; but perhaps only during cp_fold_function?) and if that evaluates to non-zero replace the condition with true, such that the middle-end would then really consider it as infinite loop regardless of -ffinite-loops. Because if one has constexpr bool bar () { return true; } void baz () { while (bar ()) ; } we want middle-end to see while (true) ; rather than while (bar ()) ; because the latter would be under -ffinite-loops decision.