;;; Return (VALUES NIL WARNINGS-P FAILURE-P).
(defun sub-compile-file (info)
(declare (type source-info info))
- (let* ((*block-compile* *block-compile-arg*)
- (*package* (sane-package))
- (*policy* *policy*)
- (*lexenv* (make-null-lexenv))
- (*source-info* info)
- (sb!xc:*compile-file-pathname* nil)
- (sb!xc:*compile-file-truename* nil)
- (*toplevel-lambdas* ())
- (*fun-names-in-this-file* ())
- (*compiler-error-bailout*
- (lambda ()
- (compiler-mumble "~2&; fatal error, aborting compilation~%")
- (return-from sub-compile-file (values nil t t))))
- (*current-path* nil)
- (*last-source-context* nil)
- (*last-original-source* nil)
- (*last-source-form* nil)
- (*last-format-string* nil)
- (*last-format-args* nil)
- (*last-message-count* 0)
- ;; FIXME: Do we need this rebinding here? It's a literal
- ;; translation of the old CMU CL rebinding to
- ;; (OR *BACKEND-INFO-ENVIRONMENT* *INFO-ENVIRONMENT*),
- ;; and it's not obvious whether the rebinding to itself is
- ;; needed that SBCL doesn't need *BACKEND-INFO-ENVIRONMENT*.
- (*info-environment* *info-environment*)
- (*gensym-counter* 0))
+ (let ((*package* (sane-package))
+ (*readtable* *readtable*)
+ (sb!xc:*compile-file-pathname* nil) ; really bound in
+ (sb!xc:*compile-file-truename* nil) ; SUB-SUB-COMPILE-FILE
+
+ (*policy* *policy*)
+ (*lexenv* (make-null-lexenv))
+ (*block-compile* *block-compile-arg*)
+ (*source-info* info)
+ (*toplevel-lambdas* ())
+ (*fun-names-in-this-file* ())
+ (*compiler-error-bailout*
+ (lambda ()
+ (compiler-mumble "~2&; fatal error, aborting compilation~%")
+ (return-from sub-compile-file (values nil t t))))
+ (*current-path* nil)
+ (*last-source-context* nil)
+ (*last-original-source* nil)
+ (*last-source-form* nil)
+ (*last-format-string* nil)
+ (*last-format-args* nil)
+ (*last-message-count* 0)
+ ;; FIXME: Do we need this rebinding here? It's a literal
+ ;; translation of the old CMU CL rebinding to
+ ;; (OR *BACKEND-INFO-ENVIRONMENT* *INFO-ENVIRONMENT*),
+ ;; and it's not obvious whether the rebinding to itself is
+ ;; needed that SBCL doesn't need *BACKEND-INFO-ENVIRONMENT*.
+ (*info-environment* *info-environment*)
+ (*gensym-counter* 0))
(handler-case
(with-compilation-values
(sb!xc:with-compilation-unit ()
--- /dev/null
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (setq *readtable* (copy-readtable nil)) ; LOAD binds *readtable*...
+
+ (set-macro-character #\] (get-macro-character #\)))
+
+ (set-dispatch-macro-character #\# #\[
+ #'(lambda (s c n) (declare (ignore c))
+ (let* ((type (if n `(unsigned-byte ,n)
+ '(unsigned-byte 8)))
+ (list (read-delimited-list #\] s nil))
+ (len (length list)))
+ (make-array (list len)
+ :element-type type
+ :initial-contents list)))))
+
+(defvar *bug-doug-mcnaught-20030914* '#4[1 2 3])
(declare (optimize (speed 0) (safety 3) (space 0)
(debug 1) (compilation-speed 0)))
(adjoin a b))
+
+;;; bug reported by Doug McNaught on sbcl-devel 2003-09-14:
+;;; COMPILE-FILE did not bind *READTABLE*
+(let* ((source "bug-doug-mcnaught-20030914.lisp")
+ (fasl (compile-file-pathname source)))
+ (labels ((check ()
+ (assert (null (get-macro-character #\]))))
+ (full-check ()
+ (check)
+ (assert (typep *bug-doug-mcnaught-20030914*
+ '(simple-array (unsigned-byte 4) (*))))
+ (assert (equalp *bug-doug-mcnaught-20030914* #(1 2 3)))
+ (makunbound '*bug-doug-mcnaught-20030914*)))
+ (compile-file source)
+ (check)
+ (load fasl)
+ (full-check)
+ (load source)
+ (full-check)
+ (delete-file fasl)))
+
\f
;;;; tests not in the problem domain, but of the consistency of the
;;;; compiler machinery itself