Index: /trunk/ccl/lib/lists.lisp
===================================================================
--- /trunk/ccl/lib/lists.lisp	(revision 264)
+++ /trunk/ccl/lib/lists.lisp	(revision 265)
@@ -156,4 +156,17 @@
 
 
+(defun alt-list-length (l)
+  "Detect (and complain about) cirucular lists; allow any atom to
+terminate the list"
+  (do* ((n 0 (1+ n))
+        (fast l)
+        (slow l))
+       ((atom fast) (if fast (the fixnum (1+ n)) n))
+    (declare (fixnum n))
+    (setq fast (cdr fast))
+    (if (logbitp 0 n)
+      (if (eq (setq slow (cdr slow)) fast)
+	(%err-disp $XIMPROPERLIST l)))))
+
 (defun butlast (list &optional (n 1 n-p))
   "Returns a new list the same as List without the N last elements."
@@ -164,5 +177,5 @@
 	       (not (typep n 'unsigned-byte))))
     (report-bad-arg n 'unsigned-byte))
-  (let* ((length (length list)))
+  (let* ((length (alt-list-length list)))
     (declare (fixnum length))		;guaranteed
     (when (< n length)
@@ -184,5 +197,5 @@
 	       (not (typep n 'unsigned-byte))))
     (report-bad-arg n 'unsigned-byte))
-  (let* ((length (length list)))
+  (let* ((length (alt-list-length list)))
     (declare (fixnum length))		;guaranteed
     (when (< n length)
