Ticket #1037: ccl-bug.lisp

File ccl-bug.lisp, 1.4 KB (added by matt.kaufmann, 22 months ago)
Line 
1; CCL bug, for this version:
2; Welcome to Clozure Common Lisp Version 1.9-dev-r15527M-trunk  (LinuxX8664)!
3; Platform info from uname -a:
4; Linux sloth 2.6.32-45-server #100-Ubuntu SMP Wed Nov 14 11:02:27 UTC 2012 x86_64 GNU/Linux
5
6; FYI, I ran this example on a Mac and did NOT see the bug:
7; Welcome to Clozure Common Lisp Version 1.9-dev-r15422M-trunk  (DarwinX8664)!
8; From uname -a:
9; Darwin unknown58b035fde782 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
10
11; I've tried to make this example as simple as follows.  I couldn't seem to
12; simplify it further.  For example, if you comment out the following line,
13; then the error goes away.
14
15(declaim (optimize (speed 3)))
16
17(defvar *inside-absstobj-update* #(0))
18
19(defun bar (z) z)
20
21(defun foo (lst x)
22  (cond ((endp lst) x)
23        (t
24         (foo (cdr lst)
25              (let* ((temp *inside-absstobj-update*)
26                     (saved (svref temp 0)))
27                (cond ((eql saved 0)
28                       (prog1 (bar x)
29                         (setf (svref temp 0) 0)))
30                      (t
31                       (setf (svref temp 0)
32                             (1+ (svref temp 0)))
33                       (prog1 x
34                         (decf (the fixnum (svref temp 0)))))))))))
35
36(when (equal (foo '(1 2)
37                  '(a b c))
38             0)
39  (error "Ouch, returned 0 but should have returned '(a b c)!"))