https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119803
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- --- gcc/ipa-cp.cc.jj 2025-04-14 22:51:13.171434430 +0200 +++ gcc/ipa-cp.cc 2025-04-14 23:42:40.515006966 +0200 @@ -923,13 +923,13 @@ ipcp_bits_lattice::meet_with_1 (widest_i m_mask = (m_mask | mask) | (m_value ^ value); if (drop_all_ones) m_mask |= m_value; - m_value &= ~m_mask; - widest_int cap_mask = wi::bit_not (wi::sub (wi::lshift (1, precision), 1)); + widest_int cap_mask = wi::shifted_mask <widest_int> (0, precision, true); m_mask |= cap_mask; if (wi::sext (m_mask, precision) == -1) return set_to_bottom (); + m_value &= ~m_mask; return m_mask != old_mask; } fixes it for me. The move of m_vale &= ~m_mask; is the actual fix, the use of wi::shifted_mask is an optimization to do a single operation instead of 3.