https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108540
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- --- gcc/range-op-float.cc.jj 2023-01-16 09:39:36.191929750 +0100 +++ gcc/range-op-float.cc 2023-01-26 13:33:48.712018907 +0100 @@ -607,6 +607,10 @@ foperator_equal::fold_range (irange &r, { if (op1 == op2) r = range_true (type); + // If one operand is -0.0 and other 0.0, they are still equal. + else if (real_iszero (&op1.lower_bound ()) + && real_iszero (&op2.lower_bound ())) + r = range_true (type); else r = range_false (type); } @@ -617,7 +621,18 @@ foperator_equal::fold_range (irange &r, frange tmp = op1; tmp.intersect (op2); if (tmp.undefined_p ()) - r = range_false (type); + { + // If one range is [whatever, -0.0] and another + // [0.0, whatever2], we don't know anything either, + // because -0.0 == 0.0. + if ((real_iszero (&op1.upper_bound ()) + && real_iszero (&op2.lower_bound ())) + || (real_iszero (&op1.lower_bound ()) + && real_iszero (&op2.upper_bound ()))) + r = range_true_and_false (type); + else + r = range_false (type); + } else r = range_true_and_false (type); } fixes both testcases, but I'm afraid I need to look at other relations too with -0.0 == 0.0 in mind.