https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125652
--- Comment #5 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:de3a13dd7f6c2856e96fc2b7924f9b34b638940f commit r17-1421-gde3a13dd7f6c2856e96fc2b7924f9b34b638940f Author: Richard Biener <[email protected]> Date: Mon Jun 8 10:50:35 2026 +0200 tree-optimization/125652 - wrong code with SCEV The following fixes a latent issue in chrec_fold_plus_poly_poly which suffers from being prone to signed overflow UB in the way it associates additions when accumulating two polynomical CHRECs. Similar to r16-2781-gafafae097232e7 the following catches the obvious cases when constants are involved without trying to address the actual underlying issue. PR tree-optimization/125652 * tree-chrec.cc (chrec_fold_plus_poly_poly): Avoid UB integer overflow in accumulating CHREC_RIGHT. * gcc.dg/torture/pr125652.c: New testcase.
