1.0.30.44: DECODE-FLOAT and INTEGER-DECODE-FOAT are not flushable
authorNikodemus Siivola <nikodemus@random-state.net>
Wed, 12 Aug 2009 11:14:15 +0000 (11:14 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Wed, 12 Aug 2009 11:14:15 +0000 (11:14 +0000)
 ...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
src/compiler/fndb.lisp
tests/compiler.pure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 6ba10e8..4a12630 100644 (file)
--- 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
index 66d8f46..60ac39a 100644 (file)
   (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))
index 3628419..ff16e82 100644 (file)
                              (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))))))
index 7caa597..3bb054a 100644 (file)
@@ -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"