--- gcc/range-op-float.cc.jj	2023-04-01 09:32:02.635423345 +0200
+++ gcc/range-op-float.cc	2023-04-03 10:42:54.000000000 +0200
@@ -831,7 +831,10 @@ public:
 		   relation_trio = TRIO_VARYING) const final override;
   relation_kind op1_op2_relation (const irange &lhs) const final override
   {
-    return lt_op1_op2_relation (lhs);
+    relation_kind ret = lt_op1_op2_relation (lhs);
+    if (ret == VREL_GE)
+      ret = VREL_VARYING; // Inverse of VREL_LT is VREL_UNGE.
+    return ret;
   }
   bool op1_range (frange &r, tree type,
 		  const irange &lhs, const frange &op2,
@@ -947,6 +950,10 @@ public:
 		   relation_trio rel = TRIO_VARYING) const final override;
   relation_kind op1_op2_relation (const irange &lhs) const final override
   {
+    relation_kind ret = le_op1_op2_relation (lhs);
+    if (ret == VREL_GT)
+      ret = VREL_VARYING; // Inverse of VREL_LE is VREL_UNGT.
+    return ret;
     return le_op1_op2_relation (lhs);
   }
   bool op1_range (frange &r, tree type,
@@ -1057,7 +1064,10 @@ public:
 		   relation_trio = TRIO_VARYING) const final override;
   relation_kind op1_op2_relation (const irange &lhs) const final override
   {
-    return gt_op1_op2_relation (lhs);
+    relation_kind ret = gt_op1_op2_relation (lhs);
+    if (ret == VREL_LE)
+      ret = VREL_VARYING; // Inverse of VREL_GT is VREL_UNLE.
+    return ret;
   }
   bool op1_range (frange &r, tree type,
 		  const irange &lhs, const frange &op2,
@@ -1177,7 +1187,10 @@ public:
 		   relation_trio = TRIO_VARYING) const final override;
   relation_kind op1_op2_relation (const irange &lhs) const final override
   {
-    return ge_op1_op2_relation (lhs);
+    relation_kind ret = ge_op1_op2_relation (lhs);
+    if (ret == VREL_LT)
+      ret = VREL_VARYING; // Inverse of VREL_GE is VREL_UNLT.
+    return ret;
   }
   bool op1_range (frange &r, tree type,
 		  const irange &lhs, const frange &op2,
@@ -1571,6 +1584,7 @@ class foperator_unordered_lt : public ra
   using range_operator_float::fold_range;
   using range_operator_float::op1_range;
   using range_operator_float::op2_range;
+  using range_operator_float::op1_op2_relation;
 public:
   bool fold_range (irange &r, tree type,
 		   const frange &op1, const frange &op2,
@@ -1599,6 +1613,13 @@ public:
 	return true;
       }
   }
+  relation_kind op1_op2_relation (const irange &lhs) const final override
+  {
+    relation_kind ret = lt_op1_op2_relation (lhs);
+    if (ret == VREL_LT)
+      ret = VREL_VARYING; // Should have been VREL_UNLT.
+    return ret;
+  }
   bool op1_range (frange &r, tree type,
 		  const irange &lhs,
 		  const frange &op2,
@@ -1682,6 +1703,7 @@ class foperator_unordered_le : public ra
   using range_operator_float::fold_range;
   using range_operator_float::op1_range;
   using range_operator_float::op2_range;
+  using range_operator_float::op1_op2_relation;
 public:
   bool fold_range (irange &r, tree type,
 		   const frange &op1, const frange &op2,
@@ -1710,6 +1732,13 @@ public:
 	return true;
       }
   }
+  relation_kind op1_op2_relation (const irange &lhs) const final override
+  {
+    relation_kind ret = le_op1_op2_relation (lhs);
+    if (ret == VREL_LE)
+      ret = VREL_VARYING; // Should have been VREL_UNLE.
+    return ret;
+  }
   bool op1_range (frange &r, tree type,
 		  const irange &lhs, const frange &op2,
 		  relation_trio = TRIO_VARYING) const final override;
@@ -1789,6 +1818,7 @@ class foperator_unordered_gt : public ra
   using range_operator_float::fold_range;
   using range_operator_float::op1_range;
   using range_operator_float::op2_range;
+  using range_operator_float::op1_op2_relation;
 public:
   bool fold_range (irange &r, tree type,
 		   const frange &op1, const frange &op2,
@@ -1817,6 +1847,13 @@ public:
 	return true;
       }
   }
+  relation_kind op1_op2_relation (const irange &lhs) const final override
+  {
+    relation_kind ret = gt_op1_op2_relation (lhs);
+    if (ret == VREL_GT)
+      ret = VREL_VARYING; // Should have been VREL_UNGT.
+    return ret;
+  }
   bool op1_range (frange &r, tree type,
 		  const irange &lhs, const frange &op2,
 		  relation_trio = TRIO_VARYING) const final override;
@@ -1900,6 +1937,7 @@ class foperator_unordered_ge : public ra
   using range_operator_float::fold_range;
   using range_operator_float::op1_range;
   using range_operator_float::op2_range;
+  using range_operator_float::op1_op2_relation;
 public:
   bool fold_range (irange &r, tree type,
 		   const frange &op1, const frange &op2,
@@ -1928,6 +1966,13 @@ public:
 	return true;
       }
   }
+  relation_kind op1_op2_relation (const irange &lhs) const final override
+  {
+    relation_kind ret = ge_op1_op2_relation (lhs);
+    if (ret == VREL_GE)
+      ret = VREL_VARYING; // Should have been VREL_UNGE.
+    return ret;
+  }
   bool op1_range (frange &r, tree type,
 		  const irange &lhs, const frange &op2,
 		  relation_trio = TRIO_VARYING) const final override;
