1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

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.
This commit is contained in:
Daniel Llorens 2021-11-04 16:02:42 +01:00
parent bf9d30f3c3
commit c6b1171c6b

View file

@ -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))