https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114121
--- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:73dac51b32575f980289c073969c6d825963d076 commit r14-9440-g73dac51b32575f980289c073969c6d825963d076 Author: Richard Biener <rguent...@suse.de> Date: Tue Mar 12 14:00:05 2024 +0100 tree-optimization/114121 - chrec_fold_{plus,multiply} and recursion The following addresses endless recursion in the chrec_fold_{plus,multiply} functions when handling sign-conversions. We only need to apply tricks when we'd fail (there's a chrec in the converted operand) and we need to make sure to not turn the other operand into something worse (for the chrec-vs-chrec case). PR tree-optimization/114121 * tree-chrec.cc (chrec_fold_plus_1): Guard recursion with converted operand properly. (chrec_fold_multiply): Likewise. Handle missed recursion. * gcc.dg/torture/pr114312.c: New testcase.