On Sat, 19 Jun 2004, Heiner Schwarte wrote: > I could track down a compiler problem to the following example: > > (setf *print-circle* T) > > (defun test() > (declare (optimize (safety 3))) > (let((tmp '(1 2 3 4 5 6 7 8))) > (setf (elt tmp 4) tmp) > (print tmp) > (print (elt tmp 4)))) > (test) > > The second print shows 5. If I replace the let-assignment by > (let ((tmp nil))(setf tmp ... the problem disappears. > > Am I missing something? (Linux x86, CMUCL CVS snapshot 2003-11; the same for > SBCL 0.8.11)
Yup; you are modifying a literal constant. My guess is that CMUCL is propagating the constant so that the second print is (print (elt '(1 2 3 4 5 6 7 8) 4)) Try (list 1 2 3 4 5 6 7 8) instead.
