https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97467
--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- Ranger can figure out that the RHS operand of a shift is a zero and feeds it to operator_lshift::op1_range, which then uses it to create a swapped [1,0] range. Testing the following patch: diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 0efa00186e8..30d2a4d3987 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -1579,6 +1579,11 @@ operator_lshift::op1_range (irange &r, wide_int shift = wi::to_wide (shift_amount); if (wi::lt_p (shift, 0, SIGNED)) return false; + if (shift == 0) + { + r = lhs; + return true; + } // Work completely in unsigned mode to start. tree utype = type;