From: Nikodemus Siivola Date: Sat, 2 Jun 2007 10:50:59 +0000 (+0000) Subject: 1.0.6.13: minor fix to the compiler's interval-arithmetic X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=d870c05118b1ac8a8df1f0b1049eacb45f69b711;p=sbcl.git 1.0.6.13: minor fix to the compiler's interval-arithmetic * When calculating the interval of (* some-number constant-zero), multiply the signums of the interval endpoints, not the numbers themselves: this avoids compile-time breakage when the zero is a float and the non-zero number is too large to be represented as a float. --- diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp index c39aeff..359e2f3 100644 --- a/src/compiler/srctran.lisp +++ b/src/compiler/srctran.lisp @@ -702,8 +702,9 @@ ;; Multiply by closed zero is special. The result ;; is always a closed bound. But don't replace this ;; with zero; we want the multiplication to produce - ;; the correct signed zero, if needed. - (* (type-bound-number x) (type-bound-number y))) + ;; the correct signed zero, if needed. Use SIGNUM + ;; to avoid trying to multiply huge bignums with 0.0. + (* (signum (type-bound-number x)) (signum (type-bound-number y)))) ((or (and (floatp x) (float-infinity-p x)) (and (floatp y) (float-infinity-p y))) ;; Infinity times anything is infinity diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 4b3d1de..c5997a4 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -2251,3 +2251,16 @@ ;;; bug in adding DATA-VECTOR-REF-WITH-OFFSET to x86-64 (assert (not (mismatch #(1.0f0 2.0f0) (make-array 2 :element-type 'single-float :initial-contents (list 1.0f0 2.0f0))))) + +;;; bug in interval-arithmetic used by the compiler: needless attempt to coerce too +;;; large bignums to floats +(dolist (op '(* / + -)) + (let ((fun (compile + nil + `(lambda (x) + (declare (type (integer 0 #.(* 2 (truncate most-positive-double-float))) x)) + (,op 0.0d0 x))))) + (loop repeat 10 + do (let ((arg (random (truncate most-positive-double-float)))) + (assert (eql (funcall fun arg) + (funcall op 0.0d0 arg))))))) diff --git a/version.lisp-expr b/version.lisp-expr index b43fe4a..0bd006d 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.6.12" +"1.0.6.13"