]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Disable decimal floating point in frange.
authorAldy Hernandez <aldyh@redhat.com>
Mon, 5 Sep 2022 13:41:39 +0000 (15:41 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Mon, 5 Sep 2022 15:57:25 +0000 (17:57 +0200)
As Jakub mentioned in the PR, because many numbers have multiple
possible representations, we can't reliably return true for singleton_p.
For that matter, we may not be capable of modeling them just yet.
Disabling them until someone with DFP knowledge can opine or extend
frange.

PR middle-end/106831

gcc/ChangeLog:

* value-range.h (frange::supports_p): Disable decimal floats.
* range-op-float.cc (frange_drop_inf): Remove DECIMAL_FLOAT_MODE_P
check.
(frange_drop_ninf): Same.

gcc/range-op-float.cc
gcc/value-range.h

index 7301e5a060b7ab81d98d92ee4f341fb0054db5c8..050f07a9867063818b17db4fc1c05f38e7bd133d 100644 (file)
@@ -204,11 +204,6 @@ frelop_early_resolve (irange &r, tree type,
 static inline void
 frange_drop_inf (frange &r, tree type)
 {
-  // FIXME: build_real() bails on decimal float modes when called with
-  // a max representable endpoint.
-  if (DECIMAL_FLOAT_MODE_P (TYPE_MODE (type)))
-    return;
-
   REAL_VALUE_TYPE max;
   real_max_representable (&max, type);
   frange tmp (type, r.lower_bound (), max);
@@ -221,11 +216,6 @@ frange_drop_inf (frange &r, tree type)
 static inline void
 frange_drop_ninf (frange &r, tree type)
 {
-  // FIXME: build_real() bails on decimal float modes when called with
-  // a max representable endpoint.
-  if (DECIMAL_FLOAT_MODE_P (TYPE_MODE (type)))
-    return;
-
   REAL_VALUE_TYPE min;
   real_min_representable (&min, type);
   frange tmp (type, min, r.upper_bound ());
index bc00f3d5b0844d76d4b61beb99e1a77bdcd36e0b..645dc76c33a833aae7c667c9702e03054bce6e20 100644 (file)
@@ -338,7 +338,10 @@ public:
          value_range_kind = VR_RANGE);
   static bool supports_p (const_tree type)
   {
-    return SCALAR_FLOAT_TYPE_P (type);
+    // ?? Decimal floats can have multiple representations for the
+    // same number.  Supporting them may be as simple as just
+    // disabling them in singleton_p.  No clue.
+    return SCALAR_FLOAT_TYPE_P (type) && !DECIMAL_FLOAT_TYPE_P (type);
   }
   virtual tree type () const override;
   virtual void set (tree, tree, value_range_kind = VR_RANGE) override;