X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler.pure.lisp;h=09457e94c6960c382ff99f020227724a5c0cb826;hb=0573ba54479d1d65e2c8a14daffd2976e249bf40;hp=72403638c11e31b121179798bf5b7551c1a20914;hpb=20b2378572cf7378f3f267e2234c4234dacfbdc9;p=sbcl.git diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 7240363..09457e9 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -1134,3 +1134,40 @@ do (dolist (x '(nil t)) (assert (eql (funcall f1 x) (funcall f2 x))))))) + +;;; +(handler-case (compile nil '(lambda (x) + (declare (optimize (speed 3) (safety 0))) + (the double-float (sqrt (the double-float x))))) + (sb-ext:compiler-note () + (error "Compiler does not trust result type assertion."))) + +(let ((f (compile nil '(lambda (x) + (declare (optimize speed (safety 0))) + (block nil + (the double-float + (multiple-value-prog1 + (sqrt (the double-float x)) + (when (< x 0) + (return :minus))))))))) + (assert (eql (funcall f -1d0) :minus)) + (assert (eql (funcall f 4d0) 2d0))) + +;;; bug 304: SBCL produced something similar to (/ (ASH x 4) 8) +(handler-case + (compile nil '(lambda (a i) + (locally + (declare (optimize (speed 3) (safety 0) (space 0) (debug 0) + (inhibit-warnings 0))) + (declare (type (alien (* (unsigned 8))) a) + (type (unsigned-byte 32) i)) + (deref a i)))) + (compiler-note () (error "The code is not optimized."))) + +(handler-case + (compile nil '(lambda (x) + (declare (type (integer -100 100) x)) + (declare (optimize speed)) + (declare (notinline identity)) + (1+ (identity x)))) + (compiler-note () (error "IDENTITY derive-type not applied.")))