0.7.1.3:
authorWilliam Harold Newman <william.newman@airmail.net>
Thu, 31 Jan 2002 16:38:44 +0000 (16:38 +0000)
committerWilliam Harold Newman <william.newman@airmail.net>
Thu, 31 Jan 2002 16:38:44 +0000 (16:38 +0000)
added new condition type BUG...
...defined BUG function to signal BUG
...made AVER use BUG
...systematically checked things matching '".*internal.*error'
to see whether they should use BUG
...picked off a few other things and made them use BUG too
(apparently forgot to check it in, oops)
partial fix for bug 147 (so that the new simpler test case
compiles, but the original test case still fails with
the original AVER failure)...
...added "Don't close over unreferenced variables just because
they're set" logic in %ADD-LAMBDA-VARS-TO-CLOSURES
...(various other tidying while hunting for this problem)

30 files changed:
BUGS
package-data-list.lisp-expr
src/code/array.lisp
src/code/condition.lisp
src/code/debug-int.lisp
src/code/early-extensions.lisp
src/code/fop.lisp
src/code/late-type.lisp
src/code/reader.lisp
src/code/stream.lisp
src/code/target-defstruct.lisp
src/code/typecheckfuns.lisp
src/compiler/compiler-error.lisp
src/compiler/dump.lisp
src/compiler/fndb.lisp
src/compiler/generic/genesis.lisp
src/compiler/globaldb.lisp
src/compiler/ir1-translators.lisp
src/compiler/ir1opt.lisp
src/compiler/ir1tran.lisp
src/compiler/ir1util.lisp
src/compiler/ir2tran.lisp
src/compiler/physenvanal.lisp
src/compiler/seqtran.lisp
src/compiler/srctran.lisp
src/compiler/target-disassem.lisp
src/pcl/low.lisp
src/pcl/vector.lisp
tests/compiler.impure.lisp
version.lisp-expr

diff --git a/BUGS b/BUGS
index 5e2693f..dbcbeb0 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -1222,13 +1222,39 @@ WORKAROUND:
                  (let ()
                    (setq x nil))))
           (when (and (digs) (digs)) x))))
-  In sbcl-0.7.1, it failed with the same
+  In sbcl-0.7.1, this second test case failed with the same
     internal error, failed AVER: "(= (LENGTH (BLOCK-SUCC CALL-BLOCK)) 1)" 
-  but after the APD patches in sbcl-0.7.1.2 (new consistency check in
+  After the APD patches in sbcl-0.7.1.2 (new consistency check in
   TARGET-IF-DESIRABLE, plus a fix in meta-vmdef.lisp to keep the
-  new consistency check from failing routinely) it fails in
-  FIND-IN-PHYSENV instead:
+  new consistency check from failing routinely) this second test case
+  failed in FIND-IN-PHYSENV instead. Fixes in sbcl-0.7.1.3 (not
+  closing over unreferenced variables) made this second test case
+  compile without error, but the original test case still fails.
   
+148:
+  In sbcl-0.7.1.3 on x86, COMPILE-FILE on this file
+    (in-package :cl-user)
+    (defvar *thing*)
+    (defvar *zoom*)
+    (defstruct foo bar bletch)
+    (defun %zeep ()
+      (labels ((kidify1 (kid)
+                )
+               (kid-frob (kid)
+                 (if *thing*
+                    (setf sweptm
+                          (m+ (frobnicate kid)
+                                    sweptm))
+                   (kidify1 kid))))
+      (declare (inline kid-frob))
+      (map nil
+          #'kid-frob
+          (the simple-vector (foo-bar perd)))))
+  fails with
+    debugger invoked on condition of type TYPE-ERROR:
+      The value NIL is not of type SB-C::NODE.
+  in IR1-OPTIMIZE-BLOCK.
+
 
 DEFUNCT CATEGORIES OF BUGS
   IR1-#:
index ab976b7..581a10e 100644 (file)
@@ -738,6 +738,7 @@ retained, possibly temporariliy, because it might be used internally."
              "AVER" "ENFORCE-TYPE"
 
             ;; ..and CONDITIONs..
+            "BUG"
             "UNSUPPORTED-OPERATOR"
             
              ;; ..and DEFTYPEs..
index 64ef331..7a8f1b2 100644 (file)
@@ -55,7 +55,7 @@
 (defun failed-%with-array-data (array start end)
   (declare (notinline %with-array-data))
   (%with-array-data array start end)
-  (error "internal error: shouldn't be here with valid parameters"))
+  (bug "called FAILED-%WITH-ARRAY-DATA with valid array parameters?"))
 \f
 ;;;; MAKE-ARRAY
 
index 6276aa8..cc7420a 100644 (file)
 \f
 ;;;; special SBCL extension conditions
 
-;;; a condition for use in stubs for operations which aren't
-;;; unsupported on some OSes/CPUs/whatever
+;;; an error apparently caused by a bug in SBCL itself
 ;;;
-;;; E.g. in sbcl-0.7.0.5, it might be appropriate to do something
-;;; like
+;;; Note that we don't make any serious effort to use this condition
+;;; for *all* errors in SBCL itself. E.g. type errors and array
+;;; indexing errors can occur in functions called from SBCL code, and
+;;; will just end up as ordinary TYPE-ERROR or invalid index error,
+;;; because the signalling code has no good way to know that the
+;;; underlying problem is a bug in SBCL. But in the fairly common case
+;;; that the signalling code does know that it's found a bug in SBCL,
+;;; this condition is appropriate, reusing boilerplate and helping
+;;; users to recognize it as an SBCL bug.
+(define-condition bug (simple-error)
+  ()
+  (:report
+   (lambda (condition stream)
+     (format stream
+            "~@<  ~? ~:@_~?~:>"
+            (simple-condition-format-control condition)
+            (simple-condition-format-arguments condition)
+            "~@<This is probably a bug in SBCL itself. (Alternatively, ~
+              SBCL might have been corrupted by bad user code, e.g. by an ~
+              undefined Lisp operation like ~S, or by stray pointers from ~
+              alien code or from unsafe Lisp code; or there might be a bug ~
+              in the OS or hardware that SBCL is running on.) If it seems to ~
+              be a bug in SBCL itself, the maintainers would like to know ~
+              how to exercise the bug so it can be fixed. Bug reports are ~
+              welcome on the SBCL mailing lists, which you can find at ~
+              <http://sbcl.sourceforge.net/>.~:@>"
+            '((fmakunbound 'compile))))))
+(defun bug (format-control &rest format-arguments)
+  (error 'bug
+        :format-control format-control
+        :format-arguments format-arguments))
+
+;;; a condition for use in stubs for operations which aren't supported
+;;; on some platforms
+;;;
+;;; E.g. in sbcl-0.7.0.5, it might be appropriate to do something like
 ;;;   #-(or freebsd linux)
 ;;;   (defun load-foreign (&rest rest)
 ;;;     (error 'unsupported-operator :name 'load-foreign))
 ;;;   #+(or freebsd linux)
 ;;;   (defun load-foreign ... actual definition ...)
 ;;; By signalling a standard condition in this case, we make it
-;;; possible for test code to distinguish between intentionally not
-;;; implemented and just screwed up somehow. (Before this condition
-;;; was defined, this was dealt with by checking for FBOUNDP, but
-;;; that didn't work reliably. In sbcl-0.7.0, a a package screwup
-;;; left the definition of LOAD-FOREIGN in the wrong package, so
-;;; it was unFBOUNDP even on architectures where it was supposed to
-;;; be supported, and the regression tests cheerfully passed because
-;;; they assumed that unFBOUNDPness meant they were running on an
-;;; system which didn't support the extension.)
+;;; possible for test code to distinguish between (1) intentionally
+;;; unimplemented and (2) unintentionally just screwed up somehow.
+;;; (Before this condition was defined, test code tried to deal with 
+;;; this by checking for FBOUNDP, but that didn't work reliably. In
+;;; sbcl-0.7.0, a a package screwup left the definition of
+;;; LOAD-FOREIGN in the wrong package, so it was unFBOUNDP even on
+;;; architectures where it was supposed to be supported, and the
+;;; regression tests cheerfully passed because they assumed that
+;;; unFBOUNDPness meant they were running on an system which didn't
+;;; support the extension.)
 (define-condition unsupported-operator (cell-error) ()
   (:report
    (lambda (condition stream)
      (format stream
-            "unsupported on this implementation: ~S"
+            "unsupported on this platform (OS, CPU, whatever): ~S"
             (cell-error-name condition)))))
 \f
 ;;;; restart definitions
index 3858678..83c7872 100644 (file)
              (unless (fill-in-code-location code-location)
                ;; This check should be unnecessary. We're missing
                ;; debug info the compiler should have dumped.
-               (error "internal error: unknown code location"))
+               (bug "unknown code location"))
              (code-location-%tlf-offset code-location))
             ;; (There used to be more cases back before sbcl-0.7.0,,
             ;; when we did special tricks to debug the IR1
              (unless (fill-in-code-location code-location)
                ;; This check should be unnecessary. We're missing
                ;; debug info the compiler should have dumped.
-               (error "internal error: unknown code location"))
+               (bug "unknown code location"))
              (code-location-%form-number code-location))
             ;; (There used to be more cases back before sbcl-0.7.0,,
             ;; when we did special tricks to debug the IR1
             ((not (fill-in-code-location code-location))
              ;; This check should be unnecessary. We're missing
              ;; debug info the compiler should have dumped.
-             (error "internal error: unknown code location"))
+             (bug "unknown code location"))
             (t
              (compiled-code-location-kind code-location)))))
     ;; (There used to be more cases back before sbcl-0.7.0,,
                 ;;
                 ;; FIXME: This error and comment happen over and over again.
                 ;; Make them a shared function.
-                (error "internal error: unknown code location"))
+                (bug "unknown code location"))
               (compiled-code-location-%live-set code-location))
              (t live-set)))))
 
 ;;; breakpoints.
 (defun handle-breakpoint-aux (breakpoints data offset component signal-context)
   (unless breakpoints
-    (error "internal error: breakpoint that nobody wants"))
+    (bug "breakpoint that nobody wants"))
   (unless (member data *executing-breakpoint-hooks*)
     (let ((*executing-breakpoint-hooks* (cons data
                                              *executing-breakpoint-hooks*)))
index 4d84e8c..9e528e8 100644 (file)
   `(unless ,expr
      (%failed-aver ,(format nil "~A" expr))))
 (defun %failed-aver (expr-as-string)
-  (error "~@<internal error, failed AVER: ~2I~_~S~:>" expr-as-string))
+  (bug "~@<failed AVER: ~2I~_~S~:>" expr-as-string))
 (defmacro enforce-type (value type)
   (once-only ((value value))
     `(unless (typep ,value ',type)
        (%failed-enforce-type ,value ',type))))
 (defun %failed-enforce-type (value type)
-  (error 'simple-type-error
+  (error 'simple-type-error ; maybe should be TYPE-BUG, subclass of BUG?
         :value value
         :expected-type type
         :format-string "~@<~S ~_is not a ~_~S~:>"
index f2ec21c..514d631 100644 (file)
 (define-fop (fop-verify-table-size 62 :stackp nil)
   (let ((expected-index (read-arg 4)))
     (unless (= *current-fop-table-index* expected-index)
-      (error "internal error: fasl table of improper size"))))
+      (bug "fasl table of improper size"))))
 (define-fop (fop-verify-empty-stack 63 :stackp nil)
   (unless (= *fop-stack-pointer* *fop-stack-pointer-on-entry*)
-    (error "internal error: fasl stack not empty when it should be")))
+    (bug "fasl stack not empty when it should be")))
 \f
 ;;;; fops for loading symbols
 
                  (8 (make-array len :element-type '(unsigned-byte 8)))
                  (16 (make-array len :element-type '(unsigned-byte 16)))
                  (32 (make-array len :element-type '(unsigned-byte 32)))
-                 (t (error "internal error: losing i-vector element size: ~S"
-                           size)))))
+                 (t (bug "losing i-vector element size: ~S" size)))))
       (declare (type index len))
       (done-with-fast-read-byte)
       (read-n-bytes *fasl-input-stream*
                  (16 (make-array len :element-type '(signed-byte 16)))
                  (30 (make-array len :element-type '(signed-byte 30)))
                  (32 (make-array len :element-type '(signed-byte 32)))
-                 (t (error "internal error: losing si-vector element size: ~S"
-                           size)))))
+                 (t (bug "losing si-vector element size: ~S" size)))))
       (declare (type index len))
       (done-with-fast-read-byte)
       (read-n-bytes *fasl-input-stream*
@@ -646,8 +644,7 @@ bug.~:@>")
        (offset (read-arg 4)))
     (declare (type index offset))
     (unless (zerop (logand offset sb!vm:lowtag-mask))
-      (error "internal error: unaligned function object, offset = #X~X"
-            offset))
+      (bug "unaligned function object, offset = #X~X" offset))
     (let ((fun (%primitive sb!c:compute-fun code-object offset)))
       (setf (%simple-fun-self fun) fun)
       (setf (%simple-fun-next fun) (%code-entry-points code-object))
index 96b5a81..6808309 100644 (file)
                   ;; an intersection type like (AND REAL (SATISFIES ODDP)),
                   ;; in which case we fall through the logic above and
                   ;; end up here, stumped.
-                  (error "~@<internal error (bug 145): The type ~S ~
-                           is too hairy to be used for a COMPLEX ~
-                           component.~:@>" typespec)))))))))
+                  (bug "~@<(known bug #145): The type ~S is too hairy to be 
+                         used for a COMPLEX component.~:@>"
+                       typespec)))))))))
 
 ;;; If X is *, return NIL, otherwise return the bound, which must be a
 ;;; member of TYPE or a one-element list of a member of TYPE.
index dacf6b2..69d1a6f 100644 (file)
                 (return-from make-float (if negative-fraction
                                             (- num)
                                             num))))))
-         ;; should never happen:       
-         (t (error "internal error in floating point reader")))))
+         ;; should never happen
+         (t (bug "bad fallthrough in floating point reader")))))
 
 (defun make-float-aux (number divisor float-format)
   (coerce (/ number divisor) float-format))
index cba489e..e93c89c 100644 (file)
                 (unread-char char stream)
                 char)
                (t
-                (error "internal error: impossible case"))))
+                (bug "impossible case"))))
        ;; by elimination, must be Gray streams FUNDAMENTAL-STREAM
        (cond ((characterp peek-type)
               (do ((char (stream-read-char stream)
                     (eof-or-lose stream eof-error-p eof-value)
                     char)))
              (t
-              (error "internal error: impossible case"))))))
+              (bug "impossible case"))))))
 
 (defun listen (&optional (stream *standard-input*))
   (let ((stream (in-synonym-of stream)))
index 4e2061c..4d6f1cb 100644 (file)
                               *raw-slot-data-list*)
                     ;; oops
                     (t
-                     (error "internal error: unexpected DSD-RAW-TYPE ~S"
-                            dsd-raw-type))))))
+                     (bug "unexpected DSD-RAW-TYPE ~S" dsd-raw-type))))))
             ;; code shared between DEFSTRUCT :TYPE LIST and
             ;; DEFSTRUCT :TYPE VECTOR cases: Handle the "typed
             ;; structure" case, with no LAYOUTs and no raw slots.
index b36fe17..2083c55 100644 (file)
       (setf (gethash typespec *typecheckfuns*) unmemoized-typecheckfun)
       ;; UNMEMOIZED-TYPECHECKFUN shouldn't be NIL unless the compiler
       ;; knew that the memo would exist, so we shouldn't be here.
-      (error "internal error: no typecheckfun memo for ~%  ~S" typespec)))
+      (bug "no typecheckfun memo for ~S" typespec)))
 
 (defun ctype-needs-to-be-interpreted-p (ctype)
   ;; What we should really do is factor out the code in
index 39bf68f..0c5e751 100644 (file)
 (defvar *compiler-error-bailout*
   (lambda () (error "COMPILER-ERROR with no bailout")))
 
-;;; We have a separate COMPILER-ERROR condition to allow us to
-;;; distinguish internal compiler errors from user errors.
-;;; Non-compiler errors put us in the debugger.
+;;; an application programmer's error caught by the compiler
+;;;
+;;; We want a separate condition for application programmer errors so
+;;; that we can distinguish them from system programming errors (bugs
+;;; in SBCL itself). Application programmer errors should be caught
+;;; and turned into diagnostic output and a FAILURE-P return value
+;;; from COMPILE or COMPILE-FILE. Bugs in SBCL itself throw us into
+;;; the debugger.
 (define-condition compiler-error (simple-error) ())
 
 ;;; Signal the appropriate condition. COMPILER-ERROR calls the bailout
@@ -47,9 +52,7 @@
          :format-control format-string
          :format-arguments format-args)
   (funcall *compiler-error-bailout*)
-  ;; FIXME: It might be nice to define a BUG or OOPS function for "shouldn't
-  ;; happen" cases like this.
-  (error "internal error, control returned from *COMPILER-ERROR-BAILOUT*"))
+  (bug "Control returned from *COMPILER-ERROR-BAILOUT*."))
 (defun compiler-warn (format-string &rest format-args)
   (apply #'warn format-string format-args)
   (values))
index eaa958e..183e2b1 100644 (file)
   (declare (type sb!assem:segment segment)
           (type fasl-output fasl-output))
   (let* ((stream (fasl-output-stream fasl-output))
-        (nwritten (write-segment-contents segment stream)))
+        (n-written (write-segment-contents segment stream)))
     ;; In CMU CL there was no enforced connection between the CODE-LENGTH
     ;; argument and the number of bytes actually written. I added this
     ;; assertion while trying to debug portable genesis. -- WHN 19990902
-    (unless (= code-length nwritten)
-      (error "internal error, code-length=~W, nwritten=~W"
-            code-length
-            nwritten)))
+    (unless (= code-length n-written)
+      (bug "code-length=~W, n-written=~W" code-length n-written)))
   (values))
 
 ;;; Dump all the fixups. Currently there are three flavors of fixup:
index 8a148a1..8423f5e 100644 (file)
 \f
 ;;;; from the "Errors" chapter:
 
-(defknown error (t &rest t) nil) ; never returns...
+(defknown error (t &rest t) nil) ; never returns
 (defknown cerror (string t &rest t) null)
 (defknown warn (t &rest t) null)
 (defknown break (&optional t &rest t) null)
+
+;;; and analogous SBCL extension:
+(defknown bug (t &rest t) nil) ; never returns
 \f
 ;;;; from the "Miscellaneous" Chapter:
 
index afcbd52..93ea581 100644 (file)
           ;; looks bad: maybe COMMON-LISP-USER? maybe an extension
           ;; package in the xc host? something we can't think of
           ;; a valid reason to dump, anyway...
-          (error "internal error: PACKAGE-NAME=~S looks too much like a typo."
-                 package-name))))
+          (bug "internal error: PACKAGE-NAME=~S looks too much like a typo."
+               package-name))))
 
   (let (;; Information about each cold-interned symbol is stored
        ;; in COLD-INTERN-INFO.
index ae0442c..c960c69 100644 (file)
   ;; instead.
   :default (if (symbol-self-evaluating-p name)
               name
-              (error "internal error: constant lookup of nonconstant ~S"
-                     name)))
+              (bug "constant lookup of nonconstant ~S" name)))
 
 (define-info-type
   :class :variable
index c749de9..3053069 100644 (file)
 ;;; VOP or %VOP.. -- WHN 2001-06-11
 ;;; FIXME: Look at doing this ^, it doesn't look too hard actually.
 (def-ir1-translator %primitive ((name &rest args) start cont)
-  (unless (symbolp name)
-    (compiler-error "internal error: Primitive name ~S is not a symbol." name))
+  (declare (type symbol name))
   (let* ((template (or (gethash name *backend-template-names*)
-                      (compiler-error
-                       "internal error: Primitive name ~A is not defined."
-                       name)))
+                      (bug "undefined primitive ~A" name)))
         (required (length (template-arg-types template)))
         (info (template-info-arg-count template))
         (min (+ required info))
         (nargs (length args)))
     (if (template-more-args-type template)
        (when (< nargs min)
-         (compiler-error "internal error: Primitive ~A was called ~
-                           with ~R argument~:P, ~
-                          but wants at least ~R."
-                         name
-                         nargs
-                         min))
+         (bug "Primitive ~A was called with ~R argument~:P, ~
+               but wants at least ~R."
+              name
+              nargs
+              min))
        (unless (= nargs min)
-         (compiler-error "internal error: Primitive ~A was called ~
-                           with ~R argument~:P, ~
-                          but wants exactly ~R."
-                         name
-                         nargs
-                         min)))
+         (bug "Primitive ~A was called with ~R argument~:P, ~
+                but wants exactly ~R."
+              name
+              nargs
+              min)))
 
     (when (eq (template-result-types template) :conditional)
-      (compiler-error
-       "%PRIMITIVE was used with a conditional template."))
+      (bug "%PRIMITIVE was used with a conditional template."))
 
     (when (template-more-results-type template)
-      (compiler-error
-       "%PRIMITIVE was used with an unknown values template."))
+      (bug "%PRIMITIVE was used with an unknown values template."))
 
     (ir1-convert start
                 cont
index 07598c4..d71be0f 100644 (file)
 
   (values))
 
-;;; Loop over the nodes in Block, looking for stuff that needs to be
+;;; Loop over the nodes in BLOCK, looking for stuff that needs to be
 ;;; optimized. We dispatch off of the type of each node with its
 ;;; reoptimize flag set:
 
         (ir1-optimize-set node)))))
   (values))
 
+;;; Try to join with a successor block. If we succeed, we return true,
+;;; otherwise false.
+;;;
 ;;; We cannot combine with a successor block if:
 ;;;  1. The successor has more than one predecessor.
 ;;;  2. The last node's CONT is also used somewhere else.
 ;;;  5. The next block has a different home lambda, and thus the
 ;;;     control transfer is a non-local exit.
 ;;;
-;;; If we succeed, we return true, otherwise false.
-;;;
-;;; Joining is easy when the successor's Start continuation is the
-;;; same from our Last's Cont. If they differ, then we can still join
+;;; Joining is easy when the successor's START continuation is the
+;;; same from our LAST's CONT. If they differ, then we can still join
 ;;; when the last continuation has no next and the next continuation
 ;;; has no uses. In this case, we replace the next continuation with
 ;;; the last before joining the blocks.
              ((and (null (block-start-uses next))
                    (eq (continuation-kind last-cont) :inside-block))
               (let ((next-node (continuation-next next-cont)))
-                ;; If next-cont does have a dest, it must be
+                ;; If NEXT-CONT does have a dest, it must be
                 ;; unreachable, since there are no uses.
                 ;; DELETE-CONTINUATION will mark the dest block as
                 ;; DELETE-P [and also this block, unless it is no
               nil))))))
 
 ;;; Join together two blocks which have the same ending/starting
-;;; continuation. The code in Block2 is moved into Block1 and Block2
+;;; continuation. The code in BLOCK2 is moved into BLOCK1 and BLOCK2
 ;;; is deleted from the DFO. We combine the optimize flags for the two
 ;;; blocks so that any indicated optimization gets done.
 (defun join-blocks (block1 block2)
index fd0a643..6936072 100644 (file)
 
 (defun muffle-warning-or-die ()
   (muffle-warning)
-  (error "internal error -- no MUFFLE-WARNING restart"))
+  (bug "no MUFFLE-WARNING restart"))
 
 ;;; Expand FORM using the macro whose MACRO-FUNCTION is FUN, trapping
 ;;; errors which occur during the macroexpansion.
       (special (process-special-decl spec res vars))
       (ftype
        (unless (cdr spec)
-        (compiler-error "No type specified in FTYPE declaration: ~S" spec))
+        (compiler-error "no type specified in FTYPE declaration: ~S" spec))
        (process-ftype-decl (second spec) res (cddr spec) fvars))
       ((inline notinline maybe-inline)
        (process-inline-decl spec res fvars))
   (dolist (decl decls)
     (dolist (spec (rest decl))
       (unless (consp spec)
-       (compiler-error "malformed declaration specifier ~S in ~S"
-                       spec
-                       decl))
+       (compiler-error "malformed declaration specifier ~S in ~S" spec decl))
       (setq env (process-1-decl spec env vars fvars cont))))
   env)
 
        (dolist (spec optional)
          (if (atom spec)
              (let ((var (varify-lambda-arg spec (names-so-far))))
-               (setf (lambda-var-arg-info var) (make-arg-info :kind :optional))
+               (setf (lambda-var-arg-info var)
+                     (make-arg-info :kind :optional))
                (vars var)
                (names-so-far spec))
              (let* ((name (first spec))
index b437237..fd32077 100644 (file)
        ((continuation-block cont)
         (block-home-lambda-or-null (continuation-block cont)))
        (t
-        (error "internal error: confused about home lambda for ~S"))))
+        (bug "confused about home lambda for ~S"))))
 
 ;;; Return the LAMBDA that is CONT's home.
 (defun continuation-home-lambda (cont)
index a6262af..7f79467 100644 (file)
@@ -82,8 +82,7 @@
        (nlx-info
         (aver (eq physenv (block-physenv (nlx-info-target thing))))
         (ir2-nlx-info-home (nlx-info-info thing))))
-      (error "~@<internal error: ~2I~_~S ~_not found in ~_~S~:>"
-            thing physenv)))
+      (bug "~@<~2I~_~S ~_not found in ~_~S~:>" thing physenv)))
 
 ;;; If LEAF already has a constant TN, return that, otherwise make a
 ;;; TN for it.
 (defun emit-psetq-moves (node block fun old-fp)
   (declare (type combination node) (type ir2-block block) (type clambda fun)
           (type (or tn null) old-fp))
-  (let* ((called-env (physenv-info (lambda-physenv fun)))
-        (this-1env (node-physenv node))
-        (actuals (mapcar (lambda (x)
-                           (when x
-                             (continuation-tn node block x)))
-                         (combination-args node))))
+  (let ((actuals (mapcar (lambda (x)
+                          (when x
+                            (continuation-tn node block x)))
+                        (combination-args node))))
     (collect ((temps)
              (locs))
       (dolist (var (lambda-vars fun))
            (locs loc))))
 
       (when old-fp
-       (dolist (thing (ir2-physenv-closure called-env))
-         (temps (find-in-physenv (car thing) this-1env))
-         (locs (cdr thing)))
-
-       (temps old-fp)
-       (locs (ir2-physenv-old-fp called-env)))
+       (let ((this-1env (node-physenv node))
+             (called-env (physenv-info (lambda-physenv fun))))
+         (dolist (thing (ir2-physenv-closure called-env))
+           (temps (find-in-physenv (car thing) this-1env))
+           (locs (cdr thing)))
+         (temps old-fp)
+         (locs (ir2-physenv-old-fp called-env))))
 
       (values (temps) (locs)))))
 
     (when (memq fname *always-optimized-away*)
       (/show (policy node speed) (policy node safety))
       (/show (policy node compilation-speed))
-      (error "internal error: full call to ~S" fname))
+      (bug "full call to ~S" fname))
 
     (when (consp fname)
       (destructuring-bind (setf stem) fname
index c96bd44..531e080 100644 (file)
            (setq did-something t)
            (close-over var ref-physenv physenv))))
       (dolist (set (basic-var-sets var))
-       (let ((set-physenv (get-node-physenv set)))
-         (unless (eq set-physenv physenv)
-           (setq did-something t)
-           (setf (lambda-var-indirect var) t)
-           (close-over var set-physenv physenv)))))
+
+       ;; Variables which are set but never referenced can be
+       ;; optimized away, and closing over them here would just
+       ;; interfere with that. (In bug 147, it *did* interfere with
+       ;; that, causing confusion later. This UNLESS solves that
+       ;; problem, but I (WHN) am not 100% sure it's best to solve
+       ;; the problem this way instead of somehow solving it
+       ;; somewhere upstream and just doing (AVER (LEAF-REFS VAR))
+       ;; here.)
+       (unless (null (leaf-refs var))
+
+         (let ((set-physenv (get-node-physenv set)))
+           (unless (eq set-physenv physenv)
+             (setf did-something t
+                   (lambda-var-indirect var) t)
+             (close-over var set-physenv physenv))))))
     did-something))
 
 ;;; Find any variables in CLAMBDA -- either directly in LAMBDA-VARS or
        (let ((result (return-result ret)))
          (do-uses (use result)
            (when (and (immediately-used-p result use)
-                    (or (not (eq (node-derived-type use) *empty-type*))
-                        (not (basic-combination-p use))
-                        (eq (basic-combination-kind use) :local)))
+                      (or (not (eq (node-derived-type use) *empty-type*))
+                          (not (basic-combination-p use))
+                          (eq (basic-combination-kind use) :local)))
                (setf (node-tail-p use) t)))))))
   (values))
index d2de8d2..5e7a97b 100644 (file)
                    (subtypep result-type-value 'vector)
                    `(coerce (apply #'%map-to-simple-vector-arity-1 fun seqs)
                             ',result-type-value))
-                  (t (give-up-ir1-transform
-                      "internal error: unexpected sequence type"))))
+                  (t (bug "impossible (?) sequence type"))))
            (t
             (let* ((seq-args (make-gensym-list (length seqs)))
                    (index-bindingoids
index 86db8a5..9855e46 100644 (file)
              :low (bound-mul (interval-low x) (interval-low y))
              :high (bound-mul (interval-high x) (interval-high y))))
            (t
-            (error "internal error in INTERVAL-MUL"))))))
+            (bug "excluded case in INTERVAL-MUL"))))))
 
 ;;; Divide two intervals.
 (defun interval-div (top bot)
              :low (bound-div (interval-low top) (interval-high bot) t)
              :high (bound-div (interval-high top) (interval-low bot) nil)))
            (t
-            (error "internal error in INTERVAL-DIV"))))))
+            (bug "excluded case in INTERVAL-DIV"))))))
 
 ;;; Apply the function F to the interval X. If X = [a, b], then the
 ;;; result is [f(a), f(b)]. It is up to the user to make sure the
index b004f45..3879374 100644 (file)
@@ -44,8 +44,9 @@
   (sort insts #'> :key #'specializer-rank))
 
 (defun specialization-error (insts)
-  (error "~@<internal disassembler error: ~2I~_Instructions either aren't related or conflict in some way: ~4I~_~S~:>"
-        insts))
+  (bug
+   "~@<Instructions either aren't related or conflict in some way: ~4I~_~S~:>"
+   insts))
 
 ;;; Given a list of instructions INSTS, Sees if one of these instructions is a
 ;;; more general form of all the others, in which case they are put into its
index 44c4036..d59c7bb 100644 (file)
                 (typep fcn 'generic-function)
                 (eq (class-of fcn) *the-class-standard-generic-function*))
             (setf (sb-kernel:%funcallable-instance-info fcn 1) new-name)
-            (error 'simple-type-error
-                   :datum fcn
-                   :expected-type 'generic-function
-                   :format-control "internal error: bad function type"))
+            (bug "unanticipated function type"))
         fcn)
        (t
         ;; pw-- This seems wrong and causes trouble. Tests show
index a33b891..12a4640 100644 (file)
               (position (posq parameter-entry slots))
               (pv-offset-form (list 'pv-offset ''.PV-OFFSET.)))
          (unless parameter-entry
-           (error "internal error in slot optimization"))
+           (bug "slot optimization bewilderment: O-I-A"))
          (unless slot-entry
            (setq slot-entry (list slot-name))
            (push slot-entry (cdr parameter-entry)))
         (position (posq parameter-entry slots))
         (pv-offset-form (list 'pv-offset ''.PV-OFFSET.)))
     (unless parameter-entry
-      (error "internal error in slot optimization"))
+      (error "slot optimization bewilderment: O-A-C"))
     (unless slot-entry
       (setq slot-entry (list name))
       (push slot-entry (cdr parameter-entry)))
index e28b656..7caa057 100644 (file)
 (assert (equal (ayup-duplicate-keys-are-ok-i-see-the-lite :k 112) 112))
 (assert (equal (ayup-duplicate-keys-are-ok-i-see-the-lite :k 'x :k 'y) 'x))
 
+;;; As reported by Alexey Dejneka (sbcl-devel 2002-01-30), in
+;;; sbcl-0.7.1 plus his patch (i.e. essentially sbcl-0.7.1.2), the
+;;; compiler barfed on this, blowing up in FIND-IN-PHYSENV looking for
+;;; the LAMBDA-VAR named NUM. That was fixed in sbcl-0.7.1.3.
+(defun parse-num (index)
+  (let (num x)
+    (flet ((digs ()
+             (setq num index))
+          (z ()
+            (let ()
+              (setq x nil))))
+      (when (and (digs) (digs)) x))))
+
 ;;; success
 (quit :unix-status 104)
index 6a019c5..2804246 100644 (file)
@@ -18,4 +18,4 @@
 ;;; for internal versions, especially for internal versions off the
 ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
 
-"0.7.1.2"
+"0.7.1.3"