https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113756
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think the issue is that ABSU_EXPR is an unary operation with signed operand and unsigned result. And update_known_bitmask was using result rather than operand sign to the operand's value/mask, so I think --- gcc/range-op.cc.jj 2024-01-03 11:51:28.199777434 +0100 +++ gcc/range-op.cc 2024-02-06 16:51:55.549127825 +0100 @@ -435,8 +435,10 @@ update_known_bitmask (irange &r, tree_co bit_value_unop (code, sign, prec, &widest_value, &widest_mask, TYPE_SIGN (lh.type ()), TYPE_PRECISION (lh.type ()), - widest_int::from (lh_bits.value (), sign), - widest_int::from (lh_bits.mask (), sign)); + widest_int::from (lh_bits.value (), + TYPE_SIGN (lh.type ())), + widest_int::from (lh_bits.mask (), + TYPE_SIGN (lh.type ()))); break; case GIMPLE_BINARY_RHS: bit_value_binop (code, sign, prec, &widest_value, &widest_mask, ought to fix this. Of course even better would be rewrite tree-ssa-cpp.cc to use wide_int rather than widest_int, but I'm afraid that is stage1 material.