When a dead EH or abnormal edge makes a call queued for noreturn fixup
unreachable, just skip processing it.
PR tree-optimization/121870
* tree-ssa-propagate.cc
(substitute_and_fold_engine::substitute_and_fold): Skip
removed stmts from noreturn fixup.
* g++.dg/torture/pr121870.C: New testcase.
--- /dev/null
+__attribute__((noreturn)) void f1(void)
+{
+ while(true) {}
+}
+static void (*fptr)(void) = f1;
+struct s1
+{
+ ~s1() {
+ fptr();
+ }
+ void DoInner() {
+ fptr();
+ }
+};
+
+void f()
+{
+ s1 xxx;
+ xxx.DoInner();
+}
while (!walker.stmts_to_fixup.is_empty ())
{
gimple *stmt = walker.stmts_to_fixup.pop ();
+ if (!gimple_bb (stmt))
+ continue;
if (dump_file && dump_flags & TDF_DETAILS)
{
fprintf (dump_file, "Fixing up noreturn call ");