https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120074
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I wonder about: --- gcc/gimple-fold.cc.jj 2025-04-21 17:04:48.000000000 +0200 +++ gcc/gimple-fold.cc 2025-05-03 12:43:29.643908582 +0200 @@ -8337,7 +8337,8 @@ fold_truth_andor_for_ifcombine (enum tre if (!lr_and_mask.get_precision ()) lr_and_mask = sign; else - lr_and_mask &= sign; + lr_and_mask &= wide_int::from (sign, lr_and_mask.get_precision (), + UNSIGNED); if (l_const.get_precision ()) l_const &= wide_int::from (lr_and_mask, l_const.get_precision (), UNSIGNED); @@ -8358,7 +8359,8 @@ fold_truth_andor_for_ifcombine (enum tre if (!rr_and_mask.get_precision ()) rr_and_mask = sign; else - rr_and_mask &= sign; + rr_and_mask &= wide_int::from (sign, rr_and_mask.get_precision (), + UNSIGNED); if (r_const.get_precision ()) r_const &= wide_int::from (rr_and_mask, r_const.get_precision (), UNSIGNED); @@ -8762,7 +8764,7 @@ fold_truth_andor_for_ifcombine (enum tre wide_int lr_mask, rr_mask; if (lr_and_mask.get_precision ()) lr_mask = wi::lshift (wide_int::from (lr_and_mask, rnprec, UNSIGNED), - xlr_bitpos); + xlr_bitpos); else lr_mask = wi::shifted_mask (xlr_bitpos, lr_bitsize, false, rnprec); if (rr_and_mask.get_precision ()) which fixes the ICE (and we punt later on on the if (ll_bitsize != lr_bitsize || rl_bitsize != rr_bitsize test because ll_bitsize and rl_bitsize are 16 while lr_bitsize and rr_bitsize are 32. The &= sign works only if they have the same bitsize.