public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Macleod <amacleod@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-2787] Add missing float fold_range prototype for floats.
Date: Thu, 22 Sep 2022 18:49:17 +0000 (GMT)	[thread overview]
Message-ID: <20220922184917.7DC243857C75@sourceware.org> (raw)

https://gcc.gnu.org/g:be2a25adbdc76a770f7470cc9f47892f7a4139ae

commit r13-2787-gbe2a25adbdc76a770f7470cc9f47892f7a4139ae
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Tue Sep 20 12:34:08 2022 -0400

    Add missing float fold_range prototype for floats.
    
    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.

Diff:
---
 gcc/range-op-float.cc | 10 ++++++++++
 gcc/range-op.cc       | 13 ++++++++++---
 gcc/range-op.h        |  5 +++++
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index 2bd3dc9253f..aa5b7ed073d 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -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,
diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index 9ae42b8331f..072ebd32109 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -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);
diff --git a/gcc/range-op.h b/gcc/range-op.h
index b4b5101a9e0..b2f063afb07 100644
--- a/gcc/range-op.h
+++ b/gcc/range-op.h
@@ -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,

                 reply	other threads:[~2022-09-22 18:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220922184917.7DC243857C75@sourceware.org \
    --to=amacleod@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).