]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add missing float fold_range prototype for floats.
authorAndrew MacLeod <amacleod@redhat.com>
Tue, 20 Sep 2022 16:34:08 +0000 (12:34 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Thu, 22 Sep 2022 18:48:28 +0000 (14:48 -0400)
Unary operations require op2 to be the range of the type of the LHS.
This is so the type for the LHS can be properly set.

* range-op-float.cc (range_operator_float::fold_range): New base
  method for "int = float op int".
* range-op.cc (range_op_handler::fold_range): New case.
* range-op.h: Update prototypes.

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

index 2bd3dc9253fa41e468e67cfa63a1f76be9aae70c..aa5b7ed073dc6c221ba69c06d988d99319739326 100644 (file)
@@ -58,6 +58,16 @@ range_operator_float::fold_range (frange &r ATTRIBUTE_UNUSED,
   return false;
 }
 
+bool
+range_operator_float::fold_range (irange &r ATTRIBUTE_UNUSED,
+                                 tree type ATTRIBUTE_UNUSED,
+                                 const frange &lh ATTRIBUTE_UNUSED,
+                                 const irange &rh ATTRIBUTE_UNUSED,
+                                 relation_kind rel ATTRIBUTE_UNUSED) const
+{
+  return false;
+}
+
 bool
 range_operator_float::fold_range (irange &r ATTRIBUTE_UNUSED,
                                  tree type ATTRIBUTE_UNUSED,
index 9ae42b8331ff549d948b160654fd03ef1c189875..072ebd321090260acd1dfaef8fa87ccad681cbab 100644 (file)
@@ -4208,9 +4208,16 @@ range_op_handler::fold_range (vrange &r, tree type,
                           as_a <irange> (rh), rel);
 
   if (is_a <irange> (r))
-    return m_float->fold_range (as_a <irange> (r), type,
-                               as_a <frange> (lh),
-                               as_a <frange> (rh), rel);
+    {
+      if (is_a <irange> (rh))
+       return m_float->fold_range (as_a <irange> (r), type,
+                                   as_a <frange> (lh),
+                                   as_a <irange> (rh), rel);
+      else
+       return m_float->fold_range (as_a <irange> (r), type,
+                                   as_a <frange> (lh),
+                                   as_a <frange> (rh), rel);
+    }
   return m_float->fold_range (as_a <frange> (r), type,
                              as_a <frange> (lh),
                              as_a <frange> (rh), rel);
index b4b5101a9e0c86147a716f42ee798a28b112fc31..b2f063afb07475337e7fe9f6c4aa7ab51d9a4069 100644 (file)
@@ -117,6 +117,11 @@ public:
                           const frange &lh,
                           const frange &rh,
                           relation_kind rel = VREL_VARYING) const;
+  // Unary operations have the range of the LHS as op2.
+  virtual bool fold_range (irange &r, tree type,
+                          const frange &lh,
+                          const irange &rh,
+                          relation_kind rel = VREL_VARYING) const;
   virtual bool fold_range (irange &r, tree type,
                           const frange &lh,
                           const frange &rh,