public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pushed] PR tree-optimization/96430: Avoid shifting by amounts larger than target int in irange self-tests.
@ 2020-08-03 16:34 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2020-08-03 16:34 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 19 bytes --]

Fixes PR.

Pushed.

[-- Attachment #2: curr.patch --]
[-- Type: text/x-patch, Size: 1422 bytes --]

commit 6c4763fa5b55f6e883ed7077b67c6175c2da63d1
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Mon Aug 3 18:30:30 2020 +0200

    Avoid shifting by amounts larger than target int in irange self-tests.
    
    gcc/ChangeLog:
    
            PR tree-optimization/96430
            * range-op.cc (operator_tests): Do not shift by 31 on targets with
            integer's smaller than 32 bits.

diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index c62e3977ce5..b7b708b488b 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -3527,15 +3527,16 @@ operator_tests ()
   }
 
   // signed: ~[-1] = OP1 >> 31
-  {
-    widest_irange lhs (INT (-1), INT (-1), VR_ANTI_RANGE);
-    widest_irange shift (INT (31), INT (31));
-    widest_irange op1;
-    op_rshift.op1_range (op1, integer_type_node, lhs, shift);
-    widest_irange negatives = range_negatives (integer_type_node);
-    negatives.intersect (op1);
-    ASSERT_TRUE (negatives.undefined_p ());
-  }
+  if (TYPE_PRECISION (integer_type_node) > 31)
+    {
+      widest_irange lhs (INT (-1), INT (-1), VR_ANTI_RANGE);
+      widest_irange shift (INT (31), INT (31));
+      widest_irange op1;
+      op_rshift.op1_range (op1, integer_type_node, lhs, shift);
+      widest_irange negatives = range_negatives (integer_type_node);
+      negatives.intersect (op1);
+      ASSERT_TRUE (negatives.undefined_p ());
+    }
 }
 
 // Run all of the selftests within this file.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-03 16:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-03 16:34 [pushed] PR tree-optimization/96430: Avoid shifting by amounts larger than target int in irange self-tests Aldy Hernandez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).