The unsupported_range class is provided for completness sake. It is a way to set VARYING/UNDEFINED ranges for unsupported ranges (currently anything not float, integer, or pointer). You can't do anything with them, except set_varying, and set_undefined. We will trap on any other operation.
This patch provides a way to copy them, just in case they creep in. This could happen in IPA under certain circumstances. gcc/ChangeLog: * value-range.cc (vrange::operator=): Add a stub to copy unsupported ranges. * value-range.h (is_a <unsupported_range>): New. (Value_Range::operator=): Support copying unsupported ranges. --- gcc/value-range.cc | 5 ++++- gcc/value-range.h | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 93c44a68365..45b1e655967 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -203,7 +203,10 @@ vrange::operator= (const vrange &src) else if (is_a <frange> (src)) as_a <frange> (*this) = as_a <frange> (src); else - gcc_unreachable (); + { + gcc_checking_assert (is_a <unsupported_range> (src)); + m_kind = src.m_kind; + } return *this; } diff --git a/gcc/value-range.h b/gcc/value-range.h index 0da2a42764a..ab982d18402 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -460,6 +460,13 @@ is_a <frange> (vrange &v) return v.m_discriminator == VR_FRANGE; } +template <> +inline bool +is_a <unsupported_range> (vrange &v) +{ + return v.m_discriminator == VR_UNKNOWN; +} + // For resizable ranges, resize the range up to HARD_MAX_RANGES if the // NEEDED pairs is greater than the current capacity of the range. @@ -624,6 +631,11 @@ Value_Range::operator= (const vrange &r) m_frange = as_a <frange> (r); m_vrange = &m_frange; } + else if (is_a <unsupported_range> (r)) + { + m_unsupported = as_a <unsupported_range> (r); + m_vrange = &m_unsupported; + } else gcc_unreachable (); -- 2.40.0