https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125776
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Andrew Pinski <[email protected]>: https://gcc.gnu.org/g:992012439d28c56424189110e00321f257a31533 commit r16-9121-g992012439d28c56424189110e00321f257a31533 Author: Andrew Pinski <[email protected]> Date: Sat Jun 13 09:38:08 2026 -0700 phiopt: Fix is_factor_profitable for debug stmts [PR125776] This is a latent bug in is_factor_profitable where we would consider a debug statement as an use for lifetime usage afterwards. So you would get a compare debug failure in some cases. pr125776-2.c fails since r15-4503-g8d6d6d537fdc75. Pushed as obvious after a bootstrap/test. Note this is slightly modifed from the trunk version since the loop is slightly different. PR tree-optimization/125776 gcc/ChangeLog: * tree-ssa-phiopt.cc (is_factor_profitable): An usage in a debug stmt should be ignored. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr125776-1.c: New test. * gcc.dg/torture/pr125776-2.c: New test. Signed-off-by: Andrew Pinski <[email protected]> (cherry picked from commit a4afea80fce5f1aafdd1174e48e9ebfc9ec8155d)
