1.0.26.12: Don't allow (LOOP FOR X ACROSS A ...) where A evaluates to NIL
authorJuho Snellman <jsnell@iki.fi>
Sun, 22 Mar 2009 19:44:13 +0000 (19:44 +0000)
committerJuho Snellman <jsnell@iki.fi>
Sun, 22 Mar 2009 19:44:13 +0000 (19:44 +0000)
        * Patch by Daniel Lowe

NEWS
src/code/loop.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 7b9c56d..fedb224 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,8 @@
 ;;;; -*- coding: utf-8; fill-column: 78 -*-
+changes in sbcl-1.0.27 relative to 1.0.26:
+  * bug fix: a type error is signaled for attempts to use the LOOP
+    keyword ACROSS for a NIL value. (thanks to Daniel Lowe)
+
 changes in sbcl-1.0.26 relative to 1.0.25:
   * incompatible change: an interruption (be it a function passed to
     INTERRUPT-THREAD or a timer function) runs in an environment where
index 6b9a43a..565ab9a 100644 (file)
@@ -916,8 +916,11 @@ code to be loaded.
 ;;;; loop types
 
 (defun loop-typed-init (data-type &optional step-var-p)
-  (when (and data-type (sb!xc:subtypep data-type 'number))
-    (let ((init (if step-var-p 1 0)))
+  (cond
+    ((null data-type)
+     nil)
+    ((sb!xc:subtypep data-type 'number)
+     (let ((init (if step-var-p 1 0)))
       (flet ((like (&rest types)
                (coerce init (find-if (lambda (type)
                                        (sb!xc:subtypep data-type type))
@@ -932,7 +935,11 @@ code to be loaded.
                      '(complex long-float)
                      '(complex float)))
               (t
-               init))))))
+               init)))))
+    ((sb!xc:subtypep data-type 'vector)
+     (coerce nil data-type))
+    (t
+     nil)))
 
 (defun loop-optional-type (&optional variable)
   ;; No variable specified implies that no destructuring is permissible.
index 930910c..e8eefd7 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.26.11"
+"1.0.26.12"