0.6.8.6: applied MNA megapatch (will be edited shortly)
[sbcl.git] / tests / compiler.pure.lisp
1 (cl:in-package :cl-user)
2
3 ;;; Exercise a compiler bug (by crashing the compiler).
4 ;;;
5 ;;; This test code is from Douglas Crosher's simplified TICKLE-BUG
6 ;;; (2000-09-06 on cmucl-imp).
7 ;;;
8 ;;; The bug was fixed by Douglas Crosher's patch, massaged for SBCL by
9 ;;; Martin Atzmueller (2000-09-13 on sbcl-devel).
10 (funcall (compile nil
11                   '(lambda ()
12                      (labels ((fun1 ()
13                                 (fun2))
14                               (fun2 ()
15                                 (when nil
16                                   (tagbody
17                                    tag
18                                    (fun2)
19                                    (go tag)))
20                                 (when nil
21                                   (tagbody
22                                    tag
23                                    (fun1)
24                                    (go tag)))))
25
26                        (fun1)
27                        nil))))
28
29 ;;; Exercise a compiler bug (by crashing the compiler).
30 ;;;
31 ;;; Tim Moore gave a patch for this bug in CMU CL 2000-05-24 on 
32 ;;; cmucl-imp, and Martin Atzmueller applied it to SBCL.
33 (funcall (compile nil
34                   '(lambda (x)
35                      (or (integerp x)
36                          (block used-by-some-y?
37                            (flet ((frob (stk)
38                                     (dolist (y stk)
39                                       (unless (rejected? y)
40                                         (return-from used-by-some-y? t)))))
41                              (declare (inline frob))
42                              (frob (rstk x))
43                              (frob (mrstk x)))
44                            nil))))
45          13)