0.7.13.pcl-class.1
[sbcl.git] / src / code / interr.lisp
index 02147a8..60959da 100644 (file)
         "A function with declared result type NIL returned:~%  ~S"
         :format-arguments (list function)))
 
+(deferr nil-array-accessed-error (array)
+  (error 'nil-array-accessed-error
+        :datum array :expected-type '(not (array nil))))
+
 (deferr division-by-zero-error (this that)
   (error 'division-by-zero
         :operation 'division
 (deferr layout-invalid-error (object layout)
   (error 'layout-invalid
         :datum object
-        :expected-type (layout-class layout)))
+        :expected-type (layout-classoid layout)))
 
 (deferr odd-key-args-error ()
   (error 'simple-program-error
         :format-arguments (list key-name)))
 
 (deferr invalid-array-index-error (array bound index)
-  (error 'simple-error
+  (error 'simple-type-error
         :format-control
         "invalid array index ~W for ~S (should be nonnegative and <~W)"
-        :format-arguments (list index array bound)))
+        :format-arguments (list index array bound)
+        :datum index
+        :expected-type `(integer 0 (,bound))))
 
 (deferr object-not-simple-array-error (object)
   (error 'type-error
         :datum object
         :expected-type '(unsigned-byte 32)))
 
+(deferr object-not-simple-array-nil-error (object)
+  (error 'type-error
+        :datum object
+        :expected-type '(simple-array nil (*))))
+
 (deferr object-not-simple-array-unsigned-byte-2-error (object)
   (error 'type-error
         :datum object
      (/show0 "about to bind ERROR-NUMBER and ARGUMENTS")
      (multiple-value-bind (error-number arguments)
         (sb!vm:internal-error-args alien-context)
+
+       ;; There's a limit to how much error reporting we can usefully
+       ;; do before initialization is complete, but try to be a little
+       ;; bit helpful before we die.
        (/show0 "back from INTERNAL-ERROR-ARGS, ERROR-NUMBER=..")
        (/hexstr error-number)
        (/show0 "cold/low ARGUMENTS=..")
        (/hexstr arguments)
+       (unless *cold-init-complete-p*
+        (%primitive print "can't recover from error in cold init, halting")
+        (%primitive sb!c:halt))
 
        (multiple-value-bind (name sb!debug:*stack-top-hint*)
           (find-interrupted-name)
     (infinite-error-protect
      (format *error-output*
             "Control stack guard page temporarily disabled: proceed with caution~%")
-     (error "Control stack exhausted (no more space for function call frames).  This is probably due to heavily nested or infinitely recursive function calls, or a tail call that SBCL cannot or has not optimized away."))))
+     (error 'control-stack-exhausted))))
+