diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2022-09-20 12:34:08 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2022-09-22 14:48:28 -0400 |
commit | be2a25adbdc76a770f7470cc9f47892f7a4139ae (patch) | |
tree | 8ce71a877a1dbee074dac21640572edc6254cd52 | |
parent | a7a6649f4e7c459a95dee1600554ad06aaeb1cf6 (diff) | |
download | gcc-be2a25adbdc76a770f7470cc9f47892f7a4139ae.zip gcc-be2a25adbdc76a770f7470cc9f47892f7a4139ae.tar.gz gcc-be2a25adbdc76a770f7470cc9f47892f7a4139ae.tar.bz2 |
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.
-rw-r--r-- | gcc/range-op-float.cc | 10 | ||||
-rw-r--r-- | gcc/range-op.cc | 13 | ||||
-rw-r--r-- | 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 2bd3dc9..aa5b7ed 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -62,6 +62,16 @@ 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, + const frange &lh ATTRIBUTE_UNUSED, const frange &rh ATTRIBUTE_UNUSED, relation_kind rel ATTRIBUTE_UNUSED) const { diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 9ae42b8..072ebd3 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 b4b5101..b2f063a 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, |