https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108880
--- Comment #10 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Another simple patch is --- a/gcc/c-family/c-gimplify.cc +++ b/gcc/c-family/c-gimplify.cc @@ -516,7 +516,7 @@ c_genericize_control_stmt (tree *stmt_p, int *walk_subtrees, void *data, tree t = tsi_stmt (i); if (TREE_CODE (t) != DEBUG_BEGIN_STMT && nondebug_stmts < 2) nondebug_stmts++; - walk_tree_1 (tsi_stmt_ptr (i), func, data, NULL, lh); + walk_tree_without_duplicates_1 (tsi_stmt_ptr (i), func, data, lh); if (TREE_CODE (t) != DEBUG_BEGIN_STMT && (nondebug_stmts > 1 || TREE_SIDE_EFFECTS (tsi_stmt (i)))) clear_side_effects = false;