https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106087
--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> --- diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc index bc533582673..03d0fcdd8d7 100644 --- a/gcc/tree-ssa-dce.cc +++ b/gcc/tree-ssa-dce.cc @@ -2061,6 +2061,10 @@ simple_dce_from_worklist (bitmap worklist) if (gimple_has_side_effects (t)) continue; + /* The defining statement needs to be defining one this name. */ + if (single_ssa_def_operand (t, SSA_OP_DEF) == nullptr) + continue; + /* Don't remove statements that are needed for non-call eh to work. */ if (stmt_unremovable_because_of_non_call_eh_p (cfun, t))