X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler.pure.lisp;h=cfc11c1fb1d5a28426a11131898c1264bf67b244;hb=970dd272dc84f7420252eadb4829cc193f795716;hp=d822e71cade726b35ba849492fbda86bc8b1a039;hpb=44c608efa2e73df1c1ab7e259db405b9060c64a1;p=sbcl.git diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index d822e71..cfc11c1 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -13,6 +13,10 @@ (cl:in-package :cl-user) +;; The tests in this file assume that EVAL will use the compiler +(when (eq sb-ext:*evaluator-mode* :interpret) + (invoke-restart 'run-tests::skip-file)) + ;;; Exercise a compiler bug (by crashing the compiler). ;;; ;;; This test code is from Douglas Crosher's simplified TICKLE-BUG @@ -2036,8 +2040,7 @@ ;; Reported by John Wiseman, sbcl-devel ;; Subject: [Sbcl-devel] float type derivation bug? ;; Date: Tue, 4 Apr 2006 15:28:15 -0700 -(with-test (:name (:type-derivation :float-bounds) - :fails-on :sbcl) +(with-test (:name (:type-derivation :float-bounds)) (compile nil '(lambda (bits) (let* ((s (if (= (ash bits -31) 0) 1 -1)) (e (logand (ash bits -23) #xff)) @@ -2049,7 +2052,7 @@ ;; Reported by James Knight ;; Subject: [Sbcl-devel] AVER: "(EQ (SB-NAME (SC-SB (TN-SC TN))) 'REGISTERS)" ;; Date: Fri, 24 Mar 2006 19:30:00 -0500 -(with-test (:name :logbitp-vop :fails-on :x86) +(with-test (:name :logbitp-vop) (compile nil '(lambda (days shift) (declare (type fixnum shift days)) @@ -2068,3 +2071,58 @@ (- (+ source-day canonicalized-shift) 7))))))) result)))) + +;;; MISC.637: incorrect delaying of conversion of optional entries +;;; with hairy constant defaults +(let ((f '(lambda () + (labels ((%f11 (f11-2 &key key1) + (labels ((%f8 (f8-2 &optional (f8-5 (if nil (return-from %f11 0) 0))) + :bad1)) + (%f8 (%f8 0))) + :bad2)) + :good)))) + (assert (eq (funcall (compile nil f)) :good))) + +;;; MISC.555: new reference to an already-optimized local function +(let* ((l '(lambda (p1) + (declare (optimize (speed 1) (safety 2) (debug 2) (space 0)) (type keyword p1)) + (keywordp p1))) + (f (compile nil l))) + (assert (funcall f :good)) + (assert (nth-value 1 (ignore-errors (funcall f 42))))) + +;;; Check that the compiler doesn't munge *RANDOM-STATE*. +(let* ((state (make-random-state)) + (*random-state* (make-random-state state)) + (a (random most-positive-fixnum))) + (setf *random-state* state) + (compile nil `(lambda (x a) + (declare (single-float x) + (type (simple-array double-float) a)) + (+ (loop for i across a + summing i) + x))) + (assert (= a (random most-positive-fixnum)))) + +;;; MISC.641: LET-conversion after physical environment analysis lost NLX-INFOs +(let ((form '(lambda () + (declare (optimize (speed 1) (space 0) (debug 2) + (compilation-speed 0) (safety 1))) + (flet ((%f3 (f3-1 &key (key1 (count (floor 0 (min -74 0)) #()))) + 0)) + (apply #'%f3 0 nil))))) + (assert (zerop (funcall (compile nil form))))) + +;;; size mismatch: # disp=1> is a :DWORD and # is a :QWORD. on x86-64 +(compile nil '(lambda () + (let ((x (make-array '(1) :element-type '(signed-byte 32)))) + (setf (aref x 0) 1)))) + +;;; step instrumentation confusing the compiler, reported by Faré +(handler-bind ((warning #'error)) + (compile nil '(lambda () + (declare (optimize (debug 2))) ; not debug 3! + (let ((val "foobar")) + (map-into (make-array (list (length val)) + :element-type '(unsigned-byte 8)) + #'char-code val)))))