guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 02/02: Avoid ash with arguments that might overflow in (


From: Daniel Llorens
Subject: [Guile-commits] 02/02: Avoid ash with arguments that might overflow in (language cps types)
Date: Fri, 5 Nov 2021 05:27:35 -0400 (EDT)

lloda pushed a commit to branch main
in repository guile.

commit c6b1171c6b5632ac04120f482af786444e17d3fe
Author: Daniel Llorens <lloda@sarc.name>
AuthorDate: Thu Nov 4 16:02:42 2021 +0100

    Avoid ash with arguments that might overflow in (language cps types)
    
    Fixes https://debbugs.gnu.org/50609
    
    * module/languages/cps/types.scm (ulsh): As stated.
---
 module/language/cps/types.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/module/language/cps/types.scm b/module/language/cps/types.scm
index d3be176..87c58d5 100644
--- a/module/language/cps/types.scm
+++ b/module/language/cps/types.scm
@@ -1444,7 +1444,9 @@ minimum, and maximum."
         (define! result &s64 &s64-min &s64-max))))
 
 (define-type-inferrer (ulsh a b result)
-  (if (<= (ash (&max/u64 a) (&max/u64 b)) &u64-max)
+  (if (and
+       (or (zero? (&max/u64 a)) (< (&max/u64 b) 64)) ; don't even try
+       (<= (ash (&max/u64 a) (&max/u64 b)) &u64-max))
       ;; No overflow; we can be precise.
       (define! result &u64
         (ash (&min/0 a) (&min/0 b))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]