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.
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,
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);
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,