https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108793
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:0a3642dde799ee2be9f2b60ec361191176390005 commit r12-9259-g0a3642dde799ee2be9f2b60ec361191176390005 Author: Richard Biener <rguent...@suse.de> Date: Mon Feb 20 12:58:50 2023 +0100 tree-optimization/108793 - niter compute type mismatch When computing the number of iterations until wrap types are mixed up, eventually leading to checking ICEs with a pointer bitwise inversion. The following uses niter_type for the calculation. PR tree-optimization/108793 * tree-ssa-loop-niter.cc (number_of_iterations_until_wrap): Use convert operands to niter_type when computing num. * gcc.dg/torture/pr108793.c: New testcase. (cherry picked from commit a7e706df2280de4a42f68b6c44401e4348d3593c)