From d9824d93818d7b212acd2bfda2c5fe0fd150c093 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Wed, 12 Aug 2009 11:14:15 +0000 Subject: [PATCH] 1.0.30.44: DECODE-FLOAT and INTEGER-DECODE-FOAT are not flushable ...as they should signal an error for non-floats in safe code, and hence UNSAFELY-FLUSHABLE. Ditto for FLOAT-SIGN, FLOAT-RADIX, FLOAT-DIGITS, and FLOAT-PRECISION, though for some reason Python seemed unwilling to delete these calls despite them being marked as flushable as well. See: https://bugs.launchpad.net/sbcl/+bug/412416 --- NEWS | 2 ++ src/compiler/fndb.lisp | 12 ++++++------ tests/compiler.pure.lisp | 21 +++++++++++++++++++++ version.lisp-expr | 2 +- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 6ba10e8..4a12630 100644 --- a/NEWS +++ b/NEWS @@ -50,6 +50,8 @@ changes relative to sbcl-1.0.30: Elsasser) * improvement: pretty-printing of various Lisp forms has been improved (thanks to Tobias Rittweiler) + * bug fix: calls to DECODE-FLOAT and INTEGER-DECODE-FLOAT whose value was + unused were deleted in safe code. (reported by John Fremlin) * bug fix: a failing AVER compiling certain MAKE-ARRAY forms. (reported by James Wright) * bug fix: some out-of-line array predicates were missing (reported by diff --git a/src/compiler/fndb.lisp b/src/compiler/fndb.lisp index 66d8f46..60ac39a 100644 --- a/src/compiler/fndb.lisp +++ b/src/compiler/fndb.lisp @@ -326,18 +326,18 @@ (movable foldable flushable explicit-check)) (defknown decode-float (float) (values float float-exponent float) - (movable foldable flushable explicit-check)) + (movable foldable unsafely-flushable explicit-check)) (defknown scale-float (float integer) float (movable foldable unsafely-flushable explicit-check)) (defknown float-radix (float) float-radix - (movable foldable flushable)) + (movable foldable unsafely-flushable)) (defknown float-sign (float &optional float) float - (movable foldable flushable explicit-check)) + (movable foldable unsafely-flushable explicit-check)) (defknown (float-digits float-precision) (float) float-digits - (movable foldable flushable explicit-check)) + (movable foldable unsafely-flushable explicit-check)) (defknown integer-decode-float (float) - (values integer float-int-exponent (member -1 1)) - (movable foldable flushable explicit-check)) + (values integer float-int-exponent (member -1 1)) + (movable foldable unsafely-flushable explicit-check)) (defknown complex (real &optional real) number (movable foldable flushable explicit-check)) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 3628419..ff16e82 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -3267,3 +3267,24 @@ (make-array (map 'list 'length stuff)))))) (assert (equalp #2A((0 0 0) (0 0 0)) (funcall fun '((1 2) (1 2 3))))))) + +(with-test (:name :fp-decoding-funs-not-flushable-in-safe-code) + (dolist (name '(float-sign float-radix float-digits float-precision decode-float + integer-decode-float)) + (let ((fun (compile nil `(lambda (x) + (declare (optimize safety)) + (,name x) + nil)))) + (flet ((test (arg) + (unless (eq :error + (handler-case + (funcall fun arg) + (error () :error))) + (error "(~S ~S) did not error" + name arg)))) + ;; No error + (funcall fun 1.0) + ;; Error + (test 'not-a-float) + (when (member name '(decode-float integer-decode-float)) + (test sb-ext:single-float-positive-infinity)))))) diff --git a/version.lisp-expr b/version.lisp-expr index 7caa597..3bb054a 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.43" +"1.0.30.44" -- 1.7.10.4