https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114462
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Ah, if there is a declaration in the condition, then it is not a valid trivial empty iteration statement. Anyway, I'd say cp_fold should for WHILE_STMT, DO_STMT and FOR_STMT if the body is a STATEMENT_LIST with no statements at all or an empty statement (do we have predicate for NOP_EXPR to void_type_node of integer_zero_node?) and in case of FOR_STMT empty increment expression argument try to evaluate the condition as mce_false constant expression and if it evaluates to constant non-zero, replace the condition with boolean_true_node.