https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108880
--- Comment #12 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Sure, it worked for the testcase because the STATEMENT_LIST only had two stmts.
I'm testing:
--- a/gcc/c-family/c-gimplify.cc
+++ b/gcc/c-family/c-gimplify.cc
@@ -516,7 +516,8 @@ 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_1 (tsi_stmt_ptr (i), func, data,
+ static_cast<hash_set<tree> *>(data), lh);
if (TREE_CODE (t) != DEBUG_BEGIN_STMT
&& (nondebug_stmts > 1 || TREE_SIDE_EFFECTS (tsi_stmt (i))))
clear_side_effects = false;
@@ -572,8 +573,9 @@ c_genericize (tree fndecl)
bc_state_t save_state;
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
save_bc_state (&save_state);
- walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl),
- c_genericize_control_r, NULL);
+ hash_set<tree> pset;
+ walk_tree (&DECL_SAVED_TREE (fndecl), c_genericize_control_r, &pset,
+ &pset);
restore_bc_state (&save_state);
pop_cfun ();
}