If any of the integer type in the union lack upper or lower bounds,
immediately abort with unknown bounds (rather than taking the MIN
of NIL and an integer).
Thanks to pfdietz for his random testing.
Fixes lp#1199127.
;;;; -*- coding: utf-8; fill-column: 78 -*-
changes relative to sbcl-1.1.9:
* enhancement: ASDF has been updated to 3.0.2.
;;;; -*- coding: utf-8; fill-column: 78 -*-
changes relative to sbcl-1.1.9:
* enhancement: ASDF has been updated to 3.0.2.
+ * bug fix: Compiling potential modularic arithmetic forms does not cause type
+ errors when some integer types lack lower or upper bounds. (lp#1199127)
changes in sbcl-1.1.9 relative to sbcl-1.1.8:
* new feature: the contrib SB-GMP links with libgmp at runtime to speed
changes in sbcl-1.1.9 relative to sbcl-1.1.8:
* new feature: the contrib SB-GMP links with libgmp at runtime to speed
(return (values nil nil)))
(let ((this-low (numeric-type-low type))
(this-high (numeric-type-high type)))
(return (values nil nil)))
(let ((this-low (numeric-type-low type))
(this-high (numeric-type-high type)))
+ (unless (and this-low this-high)
+ (return (values nil nil)))
(setf low (min this-low (or low this-low))
high (max this-high (or high this-high)))))))))
(setf low (min this-low (or low this-low))
high (max this-high (or high this-high)))))))))
;;;; various compiler tests without side effects
;;;; This software is part of the SBCL system. See the README file for
;;;; various compiler tests without side effects
;;;; This software is part of the SBCL system. See the README file for
(handler-case (eval '(cosh 90))
(floating-point-overflow ()
t)))
(handler-case (eval '(cosh 90))
(floating-point-overflow ()
t)))
+
+;; unbounded integer types could break integer arithmetic.
+(with-test (:name :bug-1199127)
+ (compile nil `(lambda (b)
+ (declare (type (integer -1225923945345 -832450738898) b))
+ (declare (optimize (speed 3) (space 3) (safety 2)
+ (debug 0) (compilation-speed 1)))
+ (loop for lv1 below 3
+ sum (logorc2
+ (if (>= 0 lv1)
+ (ash b (min 25 lv1))
+ 0)
+ -2)))))