https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99296
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- signed 1 bit precision are always a nightmare to deal with. wide_int lim1 = wi::sub (w_min, 1, sign, &ovf); gcc_checking_assert (ovf != wi::OVF_OVERFLOW); 1 is not really representable in that type, which is why I think we're getting the overflow. So I think we need to use wide_int lim1 = !sign && w_min.get_precision () == 1 ? wi::add (w_min, -1, sign, &ovf) : wi::sub (w_min, 1, sign, &ovf); instead. And in the other spot in the same function the other way around (when it is called on signed precision 1 -1, -1. One can't wi::add (w_max, 1, sign, &ovf) either, needs wi::sub (w_max, -1, sign, &ovf).