[-Inf, +Inf] was being chopped correctly for -ffinite-math-only, but
[-Inf, -Inf] was not.  This was latent because a bug in
real_isdenormal is causing us to flush -Inf to zero.

gcc/ChangeLog:

        * value-range.cc (frange::set): Normalize ranges for both bounds.
---
 gcc/value-range.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 86550f158b8..6b4f3dddcd5 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -340,8 +340,12 @@ frange::set (tree type,
       REAL_VALUE_TYPE max_repr = frange_val_max (m_type);
       if (real_less (&m_min, &min_repr))
        m_min = min_repr;
+      else if (real_less (&max_repr, &m_min))
+       m_min = max_repr;
       if (real_less (&max_repr, &m_max))
        m_max = max_repr;
+      else if (real_less (&m_max, &min_repr))
+       m_max = min_repr;
     }
 
   // Check for swapped ranges.
-- 
2.37.3

Reply via email to