From d8fe9deb949b4c9f1a266339a45bdd1ba16a9ccc Mon Sep 17 00:00:00 2001
From: dtc <dtc>
Date: Sat, 1 May 1999 04:32:45 +0000
Subject: [PATCH] Revise the error format of invalid-array-index-error-handler
 to better handle zero length arrays and negative indexes; suggested by
 Raymond Toy.

---
 code/interr.lisp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/code/interr.lisp b/code/interr.lisp
index cd05d866b..0b773440c 100644
--- a/code/interr.lisp
+++ b/code/interr.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/interr.lisp,v 1.36 1998/12/19 16:05:46 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/interr.lisp,v 1.37 1999/05/01 04:32:45 dtc Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -316,7 +316,12 @@
   (error 'simple-error
 	 :function-name name
 	 :format-control
-	 "Invalid array index, ~D for ~S.  Should have been less than ~D"
+	 (cond ((zerop bound)
+		"Invalid array index, ~D for ~S.  Array has no elements.")
+	       ((minusp index)
+		"Invalid array index, ~D for ~S.  Should have greater than or equal to 0.")
+	       (t
+		"Invalid array index, ~D for ~S.  Should have been less than ~D"))
 	 :format-arguments (list index array bound)))
 
 (deferr object-not-simple-array-error (object)
-- 
GitLab