0.8.1.6:
authorChristophe Rhodes <csr21@cam.ac.uk>
Thu, 26 Jun 2003 09:54:54 +0000 (09:54 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Thu, 26 Jun 2003 09:54:54 +0000 (09:54 +0000)
Fix off-by-one error in %CHECK-BOUNDS transform for known array
dimensions

BUGS
NEWS
src/compiler/array-tran.lisp
tests/array.pure.lisp
version.lisp-expr

diff --git a/BUGS b/BUGS
index ca347e1..7d606d7 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -1011,7 +1011,7 @@ WORKAROUND:
   array types, there's no good way to tell it you're doing it
   intentionally so that it should shut up and just compile the code.
 
   array types, there's no good way to tell it you're doing it
   intentionally so that it should shut up and just compile the code.
 
-  Another poblem is confusing error message "asserted type ARRAY
+  Another problem is confusing error message "asserted type ARRAY
   conflicts with derived type (VALUES SIMPLE-VECTOR &OPTIONAL)" during
   compiling (LAMBDA (V) (VALUES (SVREF V 0) (VECTOR-POP V))).
 
   conflicts with derived type (VALUES SIMPLE-VECTOR &OPTIONAL)" during
   compiling (LAMBDA (V) (VALUES (SVREF V 0) (VECTOR-POP V))).
 
@@ -1024,6 +1024,13 @@ WORKAROUND:
 258:
   (fixed in 0.8.1.3)
 
 258:
   (fixed in 0.8.1.3)
 
+259:
+  (compile nil '(lambda () (aref (make-array 0) 0))) compiles without
+  warning.  Analogous cases with the index and length being equal and
+  greater than 0 are warned for; the problem here seems to be that the
+  type required for an array reference of this type is (INTEGER 0 (0))
+  which is canonicalized to NIL.
+
 DEFUNCT CATEGORIES OF BUGS
   IR1-#:
     These labels were used for bugs related to the old IR1 interpreter.
 DEFUNCT CATEGORIES OF BUGS
   IR1-#:
     These labels were used for bugs related to the old IR1 interpreter.
diff --git a/NEWS b/NEWS
index 240bc66..b479b76 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1885,6 +1885,9 @@ changes in sbcl-0.8.1 relative to sbcl-0.8.0:
   * fixed bugs 3cd: structure slot readers perform type check if the
     slot can have an invalid value (i.e. it is either not initialized
     or can be written with a less specific slot writer).
   * fixed bugs 3cd: structure slot readers perform type check if the
     slot can have an invalid value (i.e. it is either not initialized
     or can be written with a less specific slot writer).
+  * bug fix: the compiler now traps array references to elements off
+    the end of an array; previously, the bounds checking in some
+    circumstances could go off-by-one.
 
 planned incompatible changes in 0.8.x:
   * (not done yet, but planned:) When the profiling interface settles
 
 planned incompatible changes in 0.8.x:
   * (not done yet, but planned:) When the profiling interface settles
index 7afe2cd..d0f9baf 100644 (file)
          (give-up-ir1-transform))
         (t
          (let ((dim (continuation-value dimension)))
          (give-up-ir1-transform))
         (t
          (let ((dim (continuation-value dimension)))
-           `(the (integer 0 ,dim) index)))))
+           `(the (integer 0 (,dim)) index)))))
 \f
 ;;;; WITH-ARRAY-DATA
 
 \f
 ;;;; WITH-ARRAY-DATA
 
index 50f9987..21b5b69 100644 (file)
   (assert (eq (array-element-type a) 'nil)))
 
 (assert (eq (upgraded-array-element-type 'nil) 'nil))
   (assert (eq (array-element-type a) 'nil)))
 
 (assert (eq (upgraded-array-element-type 'nil) 'nil))
+
+(multiple-value-bind (fun warn fail)
+    (compile nil '(lambda () (aref (make-array 0) 0)))
+  #+nil (assert fail) ; doesn't work, (maybe because ASSERTED-TYPE is NIL?)
+  (assert (raises-error? (funcall fun) type-error)))
+
+(multiple-value-bind (fun warn fail)
+    (compile nil '(lambda () (aref (make-array 1) 1)))
+  (assert fail)
+  (assert (raises-error? (funcall fun) type-error)))
+
index cee4763..455ce52 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".)
 ;;; 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".)
-"0.8.1.5"
+"0.8.1.6"