diff mbox series

[COMMITTED] Normalize ranges over the range for both bounds when -ffinite-math-only.

Message ID 20221014142652.671475-2-aldyh@redhat.com
State New
Headers show
Series [COMMITTED] Normalize ranges over the range for both bounds when -ffinite-math-only. | expand

Commit Message

Aldy Hernandez Oct. 14, 2022, 2:26 p.m. UTC
[-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 mbox series

Patch

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.