[gcc r17-3144] [frange] Guard sign-zero self test with HONOR_SIGNED_ZEROS [PR126714]

Aldy Hernandez via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:a5d4ef63b349f5729b5d6ff940c8f490754df75c

commit r17-3144-ga5d4ef63b349f5729b5d6ff940c8f490754df75c
Author: Aldy Hernandez <[email protected]>
Date:   Fri Aug 7 14:32:40 2026 +0000

    [frange] Guard sign-zero self test with HONOR_SIGNED_ZEROS [PR126714]
    
    frange_add_zeros's multi-range conversion added a self-test that
    assumes signed zeros exist, which is not the case on VAX.  Guard such
    test with HONOR_SIGNED_ZEROS.
    
    gcc/ChangeLog:
    
            PR tree-optimization/126714
            * range-op-float.cc (range_op_float_tests): Guard the signed-zero
            == op1_range self-test with HONOR_SIGNED_ZEROS.

Diff:
---
 gcc/range-op-float.cc | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index 14810bd858e7..30d22a98ae55 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -3227,15 +3227,18 @@ range_op_float_tests ()
 
   // op1_range for "op1 == op2" where op2 = [-1.0,-0.0][1.0,1.0] holds -0.0 but
   // not +0.0 must still admit +0.0 for op1, since -0.0 == +0.0.
-  r0 = frange_float ("-1.0", "-0.0");
-  r1 = frange_float ("1.0", "1.0");
-  r0.union_ (r1);
-  r0.clear_nan ();
-  ASSERT_FALSE (r0.contains_p (dconst0));
-  ASSERT_TRUE (r0.contains_p (dconstm0));
-  int_range<2> bool_true = range_true ();
-  range_op_handler (EQ_EXPR).op1_range (r, float_type_node, bool_true, r0);
-  ASSERT_TRUE (r.contains_p (dconst0));
+  if (HONOR_SIGNED_ZEROS (float_type_node))
+    {
+      r0 = frange_float ("-1.0", "-0.0");
+      r1 = frange_float ("1.0", "1.0");
+      r0.union_ (r1);
+      r0.clear_nan ();
+      ASSERT_FALSE (r0.contains_p (dconst0));
+      ASSERT_TRUE (r0.contains_p (dconstm0));
+      int_range<2> bool_true = range_true ();
+      range_op_handler (EQ_EXPR).op1_range (r, float_type_node, bool_true, r0);
+      ASSERT_TRUE (r.contains_p (dconst0));
+    }
 
   // negate([1, 2] U [10, 11]) => [-11, -10] U [-2, -1], keeping the gap.
   r0 = frange_float ("1.0", "2.0");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.