]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/118973 - stray abnormal edge after DCE
authorRichard Biener <rguenther@suse.de>
Mon, 24 Feb 2025 08:45:28 +0000 (09:45 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 24 Feb 2025 10:11:54 +0000 (11:11 +0100)
commit9e4c57f7a69d7060612c83867ecff61a719b97af
tree448c72f19528225838d817c0c8c1d6d675bac809
parent27ebd2a55cd373542977b21631b6b0919e703733
tree-optimization/118973 - stray abnormal edge after DCE

DCE preserves stmts performing abnormal control flow transfer but
currently has an exception for replaceable allocations and cxa_atexit
calls.  That results in a broken CFG since DCE isn't set up to prune
abnormal edges possibly hanging off those.

While we could try to add this handling, the following is the safe
fix at this point and more suitable for backporting.

PR tree-optimization/118973
* tree-ssa-dce.cc (mark_stmt_if_obviously_necessary): Calls
that alter control flow in unpredictable ways need to be
preserved.

* g++.dg/torture/pr118973.C: New testcase.
gcc/testsuite/g++.dg/torture/pr118973.C [new file with mode: 0644]
gcc/tree-ssa-dce.cc