X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler-1.impure-cload.lisp;h=cdad366eff6237ee7af6bbc63936f99a9032fcde;hb=fcde5281a74cb29e21550f4f979ad6356f149ab9;hp=18df67c075cad5ae522729636f304fc677459b87;hpb=be9eb6c67b5f43a095c3de17bea945c309d662e4;p=sbcl.git diff --git a/tests/compiler-1.impure-cload.lisp b/tests/compiler-1.impure-cload.lisp index 18df67c..cdad366 100644 --- a/tests/compiler-1.impure-cload.lisp +++ b/tests/compiler-1.impure-cload.lisp @@ -1,4 +1,4 @@ -;;;; miscellaneous compiler tests with side-effects (e.g. DEFUN +;;;; miscellaneous compiler tests with side effects (e.g. DEFUN ;;;; changing FDEFINITIONs and globaldb stuff) ;;;; This software is part of the SBCL system. See the README file for @@ -43,21 +43,6 @@ (+ i f))) (assert (= (exercise-valuesify 1.25) 2.25)) -;;; Don Geddis reported this test case 25 December 1999 on a CMU CL -;;; mailing list: dumping circular lists caused the compiler to enter -;;; an infinite loop. Douglas Crosher reported a patch 27 Dec 1999. -;;; The patch was tested on SBCL by Martin Atzmueller 2 Nov 2000, and -;;; merged in sbcl-0.6.8.11. -(defun q-dg1999-1 () (dolist (x '#1=("A" "B" . #1#)) x)) -(defun q-dg1999-2 () (dolist (x '#1=("C" "D" . #1#)) x)) -(defun q-dg1999-3 () (dolist (x '#1=("E" "F" . #1#)) x)) -(defun q-dg1999-4 () (dolist (x '#1=("C" "D" . #1#)) x)) -(defun useful-dg1999 (keys) - (declare (type list keys)) - (loop - for c in '#1=("Red" "Blue" . #1#) - for key in keys )) - ;;; An early version (sbcl-0.6.11.33) of code to check FTYPEs from DEFUN ;;; against DECLAIMed FTYPEs blew up when an FTYPE was DECLAIMed ;;; to be pure FUNCTION, because the internal representation of @@ -67,10 +52,9 @@ (declaim (ftype function i-am-just-a-function)) (defun i-am-just-a-function (x y) (+ x y 1)) -;;; Stig E SandPHI (where PHI is some phi-like character not -;;; representable in ASCII) reported in cclan-Bugs-431263 that SBCL -;;; couldn't compile this. sbcl-0.6.12.26 died in CIRCULAR-LIST-P with -;;; "The value \"EST\" is not of type LIST." Dan Barlow fixed it. +;;; Stig E Sandoe reported in cclan-Bugs-431263 that SBCL couldn't +;;; compile this. sbcl-0.6.12.26 died in CIRCULAR-LIST-P with "The +;;; value \"EST\" is not of type LIST." Dan Barlow fixed it. (defvar +time-zones+ '((5 "EDT" . "EST") (6 "CDT" . "CST") (7 "MDT" . "MST") (8 "PDT" . "PST") @@ -112,4 +96,81 @@ (error "Invalid pixarray: ~S." pixarray))))) (assert (eql 1 (pixarray-element-size #*110))) +;;; bug 31 turned out to be a manifestation of non-ANSI array type +;;; handling, fixed by CSR in sbcl-0.7.3.8. +(defun array-element-type-handling (x) + (declare (type (vector cons) x)) + (when (consp (aref x 0)) + (aref x 0))) +(assert (eq (array-element-type-handling + (make-array 3 :element-type t :initial-element 0)) + nil)) + +;;; bug 220: type check inserted after all arguments in MV-CALL caused +;;; failure of stack analysis +(defun bug220-helper () + 13) +(assert (equal (multiple-value-call #'list + (the integer (bug220-helper)) + nil) + '(13 nil))) + +;;; bug 221: sbcl 0.7.9.13 failed to compile the following function +(declaim (ftype (function (fixnum) (values package boolean)) bug221-f1)) +(declaim (ftype (function (t) (values package boolean)) bug221-f2)) +(defun bug221 (b x) + (funcall (if b #'bug221-f1 #'bug221-f2) x)) + +;;; bug 166: compiler failure +(defstruct bug166s) +(defmethod permanentize ((uustk bug166s)) + (flet ((frob (hash-table test-for-deletion) + ) + (obj-entry.stale? (oe) + (destructuring-bind (key . datum) oe + (declare (type simple-vector key)) + (deny0 (void? datum)) + (some #'stale? key)))) + (declare (inline frob obj-entry.stale?)) + (frob (uustk.args-hash->obj-alist uustk) + #'obj-entry.stale?) + (frob (uustk.hash->memoized-objs-list uustk) + #'objs.stale?)) + (call-next-method)) + +;;; bugs 115, 226: compiler failure in lifetime analysis +(defun bug115-1 () + (declare (optimize (speed 2) (debug 3))) + (flet ((m1 () + (unwind-protect nil))) + (if (catch nil) + (m1) + (m1)))) + +(defun bug115-2 () + (declare (optimize (speed 2) (debug 3))) + (flet ((m1 () + (bar (if (foo) 1 2)) + (let ((x (foo))) + (bar x (list x))))) + (if (catch nil) + (m1) + (m1)))) + +(defun bug226 () + (declare (optimize (speed 0) (safety 3) (debug 3))) + (flet ((safe-format (stream string &rest r) + (unless (ignore-errors (progn + (apply #'format stream string r) + t)) + (format stream "~&foo ~S" string)))) + (cond + ((eq my-result :ERROR) + (cond + ((ignore-errors (typep condition result)) + (safe-format t "~&bar ~S" result)) + (t + (safe-format t "~&baz ~S (~A) ~S" condition condition result))))))) + (sb-ext:quit :unix-status 104) ; success +