https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112430
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:7610e5cc82bd6316cfe0bfee6d9f12d8c2cfa9c3 commit r14-5366-g7610e5cc82bd6316cfe0bfee6d9f12d8c2cfa9c3 Author: Jakub Jelinek <ja...@redhat.com> Date: Sat Nov 11 20:15:53 2023 +0100 tree-ssa-math-opts: Fix up gsi_remove order in match_uaddc_usubc [PR112430] The following testcase ICEs, because the temp_stmts were removed in wrong order, from the ones appearing earlier in the IL to the later ones, so insert_debug_temps_for_defs can reintroduce dead SSA_NAMEs back into the IL. The following patch fixes that by removing them in the order they were pushed into the vector, which is from later ones to earlier ones. Additionally, I've noticed I forgot to call release_defs on the removed stmts. 2023-11-11 Jakub Jelinek <ja...@redhat.com> PR middle-end/112430 * tree-ssa-math-opts.cc (match_uaddc_usubc): Remove temp_stmts in the order they were pushed rather than in reverse order. Call release_defs after gsi_remove. * gcc.dg/pr112430.c: New test.