https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128943
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <[email protected]>: https://gcc.gnu.org/g:2f3f34ea0945a3cd4eba05ec6c5d3c353e1fbe78 commit r17-6597-g2f3f34ea0945a3cd4eba05ec6c5d3c353e1fbe78 Author: Richard Biener <[email protected]> Date: Mon Nov 23 12:51:36 2026 +0100 tree-optimization/128943 - avoid leaking conditional VN equivalences When value-numbering (T)A +- B against an available narrow operation narrow_val in visit_nary_op the result is only valid where narrow_val is executed since we rely on it not overflowing. Recording the equivalence for the expression of the statement in the global nary table makes it available to computations of the same expression in blocks not dominated by narrow_val, bypassing the availability check. PRE then hoists the narrow operation across its guard, introducing undefined signed overflow. The same applies to matching ([-]a){/,*}([-])b against an available negated operand with undefined overflow. There we still record the equivalence when the type has no undefined overflow since the identity holds unconditionally. PR tree-optimization/128943 * tree-ssa-sccvn.cc (visit_nary_op): Do not insert the statement into the nary table when it was value-numbered using an available narrow operation or an available negated operand with undefined overflow. * gcc.dg/torture/pr128943.c: New testcase.
