https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106027
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:a27e5fc76a49b759d271a828f225899434b537e9 commit r11-10302-ga27e5fc76a49b759d271a828f225899434b537e9 Author: Richard Biener <rguent...@suse.de> Date: Mon Jun 20 13:40:50 2022 +0200 middle-end/106027 - fix types in needle folding The fold_to_nonsharp_ineq_using_bound folding ends up creating invalid typed IL which confuses later foldings. The following fixes that. 2022-06-20 Richard Biener <rguent...@suse.de> PR middle-end/106027 * fold-const.c (fold_to_nonsharp_ineq_using_bound): Use the type of the prevailing comparison for the new comparison type. (fold_binary_loc): Use proper types for the A < X && A + 1 > Y to A < X && A >= Y folding. * gcc.dg/pr106027.c: New testcase. (cherry picked from commit 713f2fd923442b1be620a44240ddf786ae0ab476)