From b049b6c0e09815ca01f79090dd8343efcaac72a1 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Wed, 26 Aug 2009 20:57:49 +0000 Subject: [PATCH] 1.0.30.54: Fix a cross-compiler leak in specialized %unary-truncate Don't use host values of most-fooative fixnum. (Also expand on the comment about using an exclusive test for floats within the fixnum range) --- src/code/float.lisp | 15 +++++++++------ version.lisp-expr | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/code/float.lisp b/src/code/float.lisp index c8aee59..88ffb37 100644 --- a/src/code/float.lisp +++ b/src/code/float.lisp @@ -753,10 +753,13 @@ ;;; *not* return the second value of truncate, so it must be computed by the ;;; caller if needed. ;;; -;;; In the float case, we pick off small arguments so that compiler can use -;;; special-case operations. We use an exclusive test, since (due to round-off -;;; error), (float most-positive-fixnum) may be greater than -;;; most-positive-fixnum. +;;; In the float case, we pick off small arguments so that compiler +;;; can use special-case operations. We use an exclusive test, since +;;; (due to round-off error), (float most-positive-fixnum) is likely +;;; to be equal to (1+ most-positive-fixnum). An exclusive test is +;;; good enough, because most-positive-fixnum will be one less than a +;;; power of two, and that power of two will be exactly representable +;;; as a float (at least until we get 128-bit fixnums). (defun %unary-truncate (number) (number-dispatch ((number real)) ((integer) number) @@ -775,9 +778,9 @@ ;;; Specialized versions for floats. (macrolet ((def (type name) `(defun ,name (number) - (if (< ,(coerce most-negative-fixnum type) + (if (< ,(coerce sb!xc:most-negative-fixnum type) number - ,(coerce most-positive-fixnum type)) + ,(coerce sb!xc:most-positive-fixnum type)) (truly-the fixnum (,name number)) ;; General -- slow -- case. (multiple-value-bind (bits exp) (integer-decode-float number) diff --git a/version.lisp-expr b/version.lisp-expr index 74720dc..44b736f 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.30.53" +"1.0.30.54" -- 1.7.10.4