From 512be7140b2fa9c12ba905c27c7569c0b5c44257 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Thu, 23 Apr 2009 12:26:56 +0000 Subject: [PATCH] 1.0.27.26: fix invalid array index reporting for compiled code * Index and bound were swapped around. * Also fix the name in the type declamation for INVALID-ARRAY-INDEX-ERROR. Thanks to Stas Boukarev. --- NEWS | 2 ++ src/code/array.lisp | 3 ++- src/code/interr.lisp | 2 +- tests/array.pure.lisp | 13 +++++++++++++ version.lisp-expr | 2 +- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 66b429c..2b85056 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ ;;;; -*- coding: utf-8; fill-column: 78 -*- changes in sbcl-1.0.28 relative to 1.0.27: + * bug fix: some error messages for out-of-bound array indexes confused the + index and the bound. (thanks to Stas Boukarev) * bug fix: pretty printing malformed DEFPACKAGE forms (thanks to Sidney Markowitz) * bug fix: running regressions tests in shells without OSTYPE set now works. diff --git a/src/code/array.lisp b/src/code/array.lisp index 1df47c5..2d4ab67 100644 --- a/src/code/array.lisp +++ b/src/code/array.lisp @@ -476,7 +476,8 @@ of specialized arrays is supported." (defun data-vector-ref-with-offset (array index offset) (hairy-data-vector-ref array (+ index offset))) -(declaim (ftype (function (array integer integer &optional t) nil) signal-invalid-array-index-error)) +(declaim (ftype (function (array integer integer &optional t) nil) + invalid-array-index-error)) (defun invalid-array-index-error (array index bound &optional axis) (error 'invalid-array-index-error :array array diff --git a/src/code/interr.lisp b/src/code/interr.lisp index 9014b56..b712ad8 100644 --- a/src/code/interr.lisp +++ b/src/code/interr.lisp @@ -260,7 +260,7 @@ :format-arguments (list key-name))) (deferr invalid-array-index-error (array bound index) - (invalid-array-index-error array bound index)) + (invalid-array-index-error array index bound)) (deferr object-not-simple-array-error (object) (error 'type-error diff --git a/tests/array.pure.lisp b/tests/array.pure.lisp index 7f5c11f..0cf064f 100644 --- a/tests/array.pure.lisp +++ b/tests/array.pure.lisp @@ -261,3 +261,16 @@ (= 3 (type-error-datum e)) (equal '(integer 0 (3)) (type-error-expected-type e))) :right))))))) + +(with-test (:name :out-of-bounds-error-details) + (assert (eq :good + (handler-case + (flet ((test (array i) + (aref array i))) + (test (eval '(vector 0 1 2 3)) 6)) + (sb-int:invalid-array-index-error (e) + (when (and (equal '(integer 0 (4)) + (type-error-expected-type e)) + (eql 6 (type-error-datum e))) + :good)))))) + diff --git a/version.lisp-expr b/version.lisp-expr index b129e80..a6f8f39 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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.27.25" +"1.0.27.26" -- 1.7.10.4