master: Check for integers in array-in-bounds-p
stassats via Sbcl-commits <[email protected]>
| Newsgroups | gmane.lisp.steel-bank.cvs |
|---|---|
| Message-ID | <[email protected]> |
The branch "master" has been updated in SBCL:
via 87e2770b92e424babc02f8fb6fefba5eb0e4cf5e (commit)
from 563243a3cabe2a8089b6eae815a6c614e7d45f5b (commit)
- Log -----------------------------------------------------------------
commit 87e2770b92e424babc02f8fb6fefba5eb0e4cf5e
Author: Stas Boukarev <[email protected]>
Date: Fri Apr 10 19:36:23 2026 +0300
Check for integers in array-in-bounds-p
---
src/code/array.lisp | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/code/array.lisp b/src/code/array.lisp
index 9dec4e050..cd17e958f 100644
--- a/src/code/array.lisp
+++ b/src/code/array.lisp
@@ -1083,16 +1083,22 @@ of specialized arrays is supported."
length rank))
(loop for i below length
for s = (fast-&rest-nth i subscripts)
- always (and (typep s '(and fixnum unsigned-byte))
- (< s (%array-dimension array i))))))
+ always (cond ((typep s '(and fixnum unsigned-byte))
+ (< s (%array-dimension array i)))
+ (t
+ (the integer s)
+ nil)))))
((/= length 1)
(error "Wrong number of subscripts, ~W, for array of rank 1."
length))
(t
(let ((subscript (fast-&rest-nth 0 subscripts)))
- (and (typep subscript '(and fixnum unsigned-byte))
- (< subscript
- (length (truly-the (simple-array * (*)) array)))))))))
+ (cond ((typep subscript '(and fixnum unsigned-byte))
+ (< subscript
+ (length (truly-the (simple-array * (*)) array))))
+ (t
+ (the integer subscript)
+ nil)))))))
(defun array-row-major-index (array &rest subscripts)
(declare (dynamic-extent subscripts))
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL