+;;; let-conversion of a function into deleted one
+(defun #:foo (a c)
+ (declare (type (integer -883 1566) a)
+ (type (integer -1 0) c)
+ (optimize (speed 3) (safety 1) (debug 1)))
+ (flet ((%f8 () c))
+ (flet ((%f5 ()
+ (if (< c a)
+ (return-from %f5 (if (= -4857 a) (%f8) (%f8)))
+ c)))
+ (if (<= 11 c) (%f5) c))))
+
+;;; two bugs: "aggressive" deletion of optional entries and problems
+;;; of FIND-RESULT-TYPE in dealing with deleted code; reported by
+;;; Nikodemus Siivola (simplified version)
+(defun lisp-error-error-handler (condition)
+ (invoke-debugger condition)
+ (handler-bind ()
+ (unwind-protect
+ (with-simple-restart
+ (continue "return to hemlock's debug loop.")
+ (invoke-debugger condition))
+ (device))))
+
+;;;
+(defun #:foo ()
+ (labels ((foo (x)
+ (return-from foo x)
+ (block u
+ (labels ((bar (x &optional (y (return-from u)))
+ (list x y (apply #'bar (fee)))))
+ (list (bar 1) (bar 1 2))))
+ (1+ x)))
+ #'foo))
+
+(defun #:foo (b c)
+ (declare (type (integer 0 1) b) (optimize (speed 3)))
+ (flet ((%f2 () (lognor (block b5 138) c)))
+ (if (not (or (= -67399 b) b))
+ (deposit-field (%f2) (byte 11 8) -3)
+ c)))
+
+;;; bug 214: compiler failure
+(defun bug214a1 ()
+ (declare (optimize (sb-ext:inhibit-warnings 0) (compilation-speed 2)))
+ (flet ((foo (&key (x :vx x-p)) (list x x-p)))
+ (foo :x 2)))
+
+(defun bug214a2 ()
+ (declare (optimize (sb-ext:inhibit-warnings 0) (compilation-speed 2)))
+ (lambda (x) (declare (fixnum x)) (if (< x 0) 0 (1- x))))
+
+;;; this one was reported by rydis on #lisp
+(defun 214b (n)
+ (declare (fixnum n))
+ (declare (optimize (speed 2) (space 3)))
+ (dotimes (k n)
+ (princ k)))
+
+;;; bug reported by Brian Downing: incorrect detection of MV-LET
+(DEFUN #:failure-testcase (SESSION)
+ (LABELS ((CONTINUATION-1 ()
+ (PROGN
+ (IF (foobar-1 SESSION)
+ (CONTINUATION-2))
+ (LET ((CONTINUATION-3
+ #'(LAMBDA ()
+ (MULTIPLE-VALUE-CALL #'CONTINUATION-2
+ (CONTINUATION-1)))))
+ (foobar-2 CONTINUATION-3))))
+ (CONTINUATION-2 (&REST OTHER-1)
+ (DECLARE (IGNORE OTHER-1))))
+ (continuation-1)))
+
+;;; reported by antifuchs/bdowning/etc on #lisp: ITERATE failure on
+;;; (iter (for i in '(1 2 3)) (+ i 50))
+(defun values-producer () (values 1 2 3 4 5 6 7))
+
+(defun values-consumer (fn)
+ (let (a b c d e f g h)
+ (multiple-value-bind (aa bb cc dd ee ff gg hh) (funcall fn)
+ (setq a aa)
+ (setq b bb)
+ (setq c cc)
+ (setq d dd)
+ (setq e ee)
+ (setq f ff)
+ (setq g gg)
+ (setq h hh)
+ (values a b c d e f g h))))
+
+(let ((list (multiple-value-list (values-consumer #'values-producer))))
+ (assert (= (length list) 8))
+ (assert (null (nth 7 list))))
+
+;;; bug 313: source transforms were "lisp-1"
+(defun srctran-lisp1-1 (cadr) (if (functionp cadr) (funcall cadr 1) nil))
+(assert (eql (funcall (eval #'srctran-lisp1-1) #'identity) 1))
+(defvar caar)
+(defun srctran-lisp1-2 (caar) (funcall (sb-ext:truly-the function caar) 1))
+(assert (eql (funcall (eval #'srctran-lisp1-2) #'identity) 1))