X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler.impure.lisp;h=7806b50826de6e2272bf91b14a2e4c038fda4e15;hb=6c129930bd75f25a66aa0cbf0e5bc8091401d5ce;hp=459e522c82dc238ec8ac986c1316528b1f22a47a;hpb=2d199c38017184ff74aedef2aa9c4320d596f46e;p=sbcl.git diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index 459e522..7806b50 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -77,6 +77,107 @@ (defun bug150-test2 () (let () (<))) + +;;; bug 147, fixed by APD 2002-04-28 +;;; +;;; This test case used to crash the compiler, e.g. with +;;; failed AVER: "(= (LENGTH (BLOCK-SUCC CALL-BLOCK)) 1)" +(defun bug147 (string ind) + (flet ((digs () + (let (old-index) + (if (and (< ind ind) + (typep (char string ind) '(member #\1))) + nil)))))) + +;;; bug reported and fixed by Matthias Hoelzl sbcl-devel 2002-05-13 +(defmacro foo-2002-05-13 () ''x) +(eval '(foo-2002-05-13)) +(compile 'foo-2002-05-13) +(foo-2002-05-13) ; (The bug caused UNDEFINED-FUNCTION to be signalled here.) + +;;; floating point pain on the PPC. +;;; +;;; This test case used to fail to compile on most powerpcs prior to +;;; sbcl-0.7.4.2x, as floating point traps were being incorrectly +;;; masked. +(defun floating-point-pain (x) + (declare (single-float x)) + (log x)) + +;;; bug found and fixed ca. sbcl-0.7.5.12: The INTERSECTION-TYPE +;;; here satisfies "is a subtype of ARRAY-TYPE", but can't be +;;; accessed with ARRAY-TYPE accessors like +;;; ARRAY-TYPE-SPECIALIZED-ELEMENT-TYPE, so ARRAY-related +;;; DEFTRANSFORMs died with TYPE-ERROR at compile time when +;;; compiling the DEFUN here. +(defun stupid-input-to-smart-array-deftransforms-0-7-5-12 (v) + (declare (type (and simple-vector fwd-type-ref) v)) + (aref v 0)) + +;;; Ca. sbcl-0.7.5.15 the compiler would fail an internal consistency +;;; check on this code because it expected all calls to %INSTANCE-REF +;;; to be transformed away, but its expectations were dashed by perverse +;;; code containing app programmer errors like this. +(defstruct something-known-to-be-a-struct x y) +(multiple-value-bind (fun warnings-p failure-p) + (compile nil + '(lambda () + (labels ((a1 (a2 a3) + (cond (t (a4 a2 a3)))) + (a4 (a2 a3 a5 a6) + (declare (type (or simple-vector null) a5 a6)) + (something-known-to-be-a-struct-x a5)) + (a8 (a2 a3) + (a9 #'a1 a10 a2 a3)) + (a11 (a2 a3) + (cond ((and (funcall a12 a2) + (funcall a12 a3)) + (funcall a13 a2 a3)) + (t + (when a14 + (let ((a15 (a1 a2 a3))) + )) + a16)))) + (values #'a17 #'a11)))) + ;; Python sees the structure accessor on the known-not-to-be-a-struct + ;; A5 value and is very, very disappointed in you. (But it doesn't + ;; signal BUG any more.) + (assert failure-p)) + +;;; On the SPARC, there was an erroneous definition of some VOPs used +;;; to compile LOGANDs, which would lead to compilation of the +;;; following function giving rise to a compile-time error (bug +;;; spotted and fixed by Raymond Toy for CMUCL) +(defun logand-sparc-bogons (a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) + (declare (type (unsigned-byte 32) a0) + (type (signed-byte 32) a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) + ;; to ensure that the call is a candidate for + ;; transformation + (optimize (speed 3) (safety 0) (compilation-speed 0) (debug 0))) + (values + ;; the call that fails compilation + (logand a0 a10) + ;; a call to prevent the other arguments from being optimized away + (logand a1 a2 a3 a4 a5 a6 a7 a8 a9))) + +;;; BUG 48a. and b. (symbol-macrolet handling), fixed by Eric Marsden +;;; and Raymond Toy for CMUCL, fix ported for sbcl-0.7.6.18. +(multiple-value-bind (function warnings-p failure-p) + (compile nil '(lambda () (symbol-macrolet ((t nil)) t))) + (assert failure-p) + (assert (raises-error? (funcall function) program-error))) + +(multiple-value-bind (function warnings-p failure-p) + (compile nil '(lambda () (symbol-macrolet ((*standard-input* nil)) *standard-input*))) + (assert failure-p) + (assert (raises-error? (funcall function) program-error))) +#| +BUG 48c, not yet fixed: +(multiple-value-bind (function warnings-p failure-p) + (compile nil '(lambda () (symbol-macrolet ((s nil)) (declare (special s)) s))) + (assert failure-p) + (assert (raises-error? (funcall function) program-error))) +|# ;;;; tests not in the problem domain, but of the consistency of the ;;;; compiler machinery itself