1.0.37.17: multiplication-by-one misoptimization in (FLOAT-ACCURACY 0) policies
authorNikodemus Siivola <nikodemus@random-state.net>
Tue, 30 Mar 2010 10:09:04 +0000 (10:09 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Tue, 30 Mar 2010 10:09:04 +0000 (10:09 +0000)
 * Our transforms optimized (* <int> 1.0) into <int>. Oops.

NEWS
src/compiler/float-tran.lisp
tests/compiler.pure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index ebd870c..e8f657f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ changes relative to sbcl-1.0.36:
   * bug fix: a semaphore with multiple waiters and some of them unwinding due
     to timeouts could be left in an inconsistent state.
   * bug fix: fix typo in "Reporting Bugs" section of the manual (lp#520366)
+  * bug fix: misoptimization of multiplication by one in
+    (SB-C::FLOAT-ACCURACY 0) policies.
 
 changes in sbcl-1.0.37 relative to sbcl-1.0.36:
   * enhancement: Backtrace from THROW to uncaught tag on x86oids now shows
index c9879b9..648f2f5 100644 (file)
                   (if (minusp y)
                       '(%negate x)
                       'x)))))
-  (def * single-float 1.0 -1.0)
-  (def * double-float 1.0d0 -1.0d0))
+  (def single-float 1.0 -1.0)
+  (def double-float 1.0d0 -1.0d0))
 
 ;;; Return the reciprocal of X if it can be represented exactly, NIL otherwise.
 (defun maybe-exact-reciprocal (x)
index b261b83..5ef755f 100644 (file)
     (assert (not (ctu:find-named-callees fun)))
     (assert (= 1 (funcall fun #*000001)))
     (assert (= 0 (funcall fun #*000010)))))
+
+(with-test (:name :mult-by-one-in-float-acc-zero)
+  (assert (eql 1.0 (funcall (compile nil `(lambda (x)
+                                            (declare (optimize (sb-c::float-accuracy 0)))
+                                            (* x 1.0)))
+                            1)))
+  (assert (eql -1.0 (funcall (compile nil `(lambda (x)
+                                             (declare (optimize (sb-c::float-accuracy 0)))
+                                             (* x -1.0)))
+                             1)))
+  (assert (eql 1.0d0 (funcall (compile nil `(lambda (x)
+                                              (declare (optimize (sb-c::float-accuracy 0)))
+                                              (* x 1.0d0)))
+                              1)))
+  (assert (eql -1.0d0 (funcall (compile nil `(lambda (x)
+                                               (declare (optimize (sb-c::float-accuracy 0)))
+                                               (* x -1.0d0)))
+                               1))))
index a34cbb9..95f6627 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.37.16"
+"1.0.37.17"