https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114409
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I had another look at this. The reason why this works without the pragmas (i.e. without ANNOTATE_EXPRs) is that the WHILE_COND/FOR_COND are handled not by tsubst_expr but tsubst_stmt: case FOR_STMT: stmt = begin_for_stmt (NULL_TREE, NULL_TREE); RECUR (FOR_INIT_STMT (t)); finish_init_stmt (stmt); tmp = RECUR (FOR_COND (t)); finish_for_cond (tmp, stmt, false, 0, false); and case WHILE_STMT: stmt = begin_while_stmt (); tmp = RECUR (WHILE_COND (t)); finish_while_stmt_cond (tmp, stmt, false, 0, false); in tsubst_stmt, where RECUR in that case means tsubst_stmt, not tsubst_expr. So, one possible fix is to use tsubst_stmt rather than RECUR aka tsubst_expr on the first operand of ANNOTATE_EXPR. And another would be to move the ANNOTATE_EXPR handling from tsubst_expr to tsubst_stmt.