From 464f0503b91f11ba65e95319088cb68ee872c76f Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Fri, 14 Oct 2022 12:07:40 +0200 Subject: [PATCH] Normalize ranges over the range for both bounds when -ffinite-math-only. [-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 86550f158b89..6b4f3dddcd59 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.47.2