+ (error "expected ~S in FUNCALL COMPILE ~S" expected-result form))
+ ;; also do some testing of compilation and verification that
+ ;; errors are thrown appropriately.
+ (unless (eql expected-result
+ (funcall (compile nil `(lambda () (aref ,form 3)))))
+ (error "expected ~S in COMPILED-AREF ~S" expected-result form))
+ (when type
+ (unless (eql expected-result
+ (funcall (compile nil `(lambda () (let ((x ,form))
+ (declare (type ,type x))
+ (aref x 3))))))
+ (error "expected ~S in COMPILED-DECLARED-AREF ~S" expected-result form)))
+ (when (ignore-errors (aref (eval form) 12))
+ (error "error not thrown in EVAL ~S" form))
+ (when (ignore-errors (aref (funcall (compile nil `(lambda () ,form))) 12))
+ (error "error not thrown in FUNCALL COMPILE ~S"))
+ (when (ignore-errors (funcall (compile nil `(lambda () (aref ,form 12)))))
+ (error "error not thrown in COMPILED-AREF ~S" form))
+ (when type
+ (when (ignore-errors (funcall
+ (compile nil `(lambda () (let ((x ,form))
+ (declare (type ,type x))
+ (aref x 12))))))
+ (error "error not thrown in COMPILED-DECLARED-AREF ~S" form))))))
+
+;;; On the SPARC, until sbcl-0.7.7.20, there was a bug in array
+;;; references for small vector elements (spotted by Raymond Toy); the
+;;; bug persisted on the PPC until sbcl-0.7.8.20.
+(let (vector)
+ (loop for i below 64
+ for list = (make-list 64 :initial-element 1)
+ do (setf (nth i list) 0)
+ do (setf vector (make-array 64 :element-type 'bit
+ :initial-contents list))
+ do (assert (= (funcall
+ (compile nil
+ `(lambda (rmdr)
+ (declare (type (simple-array bit (*)) rmdr)
+ (optimize (speed 3) (safety 0)))
+ (aref rmdr ,i)))
+ vector)
+ 0))))