https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118973
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- The issue is we have a broken CFG with an empty BB with an outgoing abnormal edge. Somebody failed to prune this edge. DCE it is: > diff -u t.c.045t.dse1 t.c.046t.cddce1 --- t.c.045t.dse1 2025-02-24 09:30:15.013311568 +0100 +++ t.c.046t.cddce1 2025-02-24 09:30:15.017311568 +0100 @@ -31,10 +31,8 @@ ;; basic block 5, loop depth 0 ;; pred: 4 - operator new (4); -;; succ: 7 +;; succ: 3 ;; 6 -;; 3 ;; basic block 6, loop depth 0 ;; pred: 4 @@ -44,7 +42,6 @@ ;; basic block 7, loop depth 0 ;; pred: 2 -;; 5 <L3>: resx 1 ;; succ: it doesn't look like DCE handles EH or abnormal edges in any special way ... the intent was we preserve those, but removable call handling ignores this. diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc index 461283ba858..3519694980e 100644 --- a/gcc/tree-ssa-dce.cc +++ b/gcc/tree-ssa-dce.cc @@ -392,8 +392,8 @@ mark_stmt_if_obviously_necessary (gimple *stmt, bool aggressive) gcall *call = as_a <gcall *> (stmt); /* Never elide a noreturn call we pruned control-flow for. */ - if ((gimple_call_flags (call) & ECF_NORETURN) - && gimple_call_ctrl_altering_p (call)) + if (/*(gimple_call_flags (call) & ECF_NORETURN) + &&*/ gimple_call_ctrl_altering_p (call)) { mark_stmt_necessary (call, true); return; fixes this.