From: Andrew MacLeod Date: Tue, 20 Sep 2022 16:34:08 +0000 (-0400) Subject: Add missing float fold_range prototype for floats. X-Git-Tag: basepoints/gcc-14~4420 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be2a25adbdc76a770f7470cc9f47892f7a4139ae;p=thirdparty%2Fgcc.git 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 --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index 2bd3dc9253fa..aa5b7ed073dc 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 9ae42b8331ff..072ebd321090 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 (rh), rel); if (is_a (r)) - return m_float->fold_range (as_a (r), type, - as_a (lh), - as_a (rh), rel); + { + if (is_a (rh)) + return m_float->fold_range (as_a (r), type, + as_a (lh), + as_a (rh), rel); + else + return m_float->fold_range (as_a (r), type, + as_a (lh), + as_a (rh), rel); + } return m_float->fold_range (as_a (r), type, as_a (lh), as_a (rh), rel); diff --git a/gcc/range-op.h b/gcc/range-op.h index b4b5101a9e0c..b2f063afb074 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,