Michael Becker, Gabriel Dos Reis, and Cyrus Harmon)
* bug fix: :PTY option in RUN-PROGRAM was broken with stream arguments.
(reported by Elliot Slaughter, thanks to Stas Boukarev)
+ * bug fix: bogus undefined variable warnings from fopcompiled references to
+ global variables. (thanks to Lars Rune Nøstdal)
changes in sbcl-1.0.29 relative to 1.0.28:
* IMPORTANT: bug database has moved from the BUGS file to Launchpad
;; Symbol macro
(fopcompile macroexpansion path for-value-p)
(let ((kind (info :variable :kind form)))
- (if (member kind '(:special :constant))
- ;; Special variable
- (fopcompile `(symbol-value ',form) path for-value-p)
- ;; Lexical
- (let* ((lambda-var (cdr (assoc form (lexenv-vars *lexenv*))))
- (handle (when lambda-var
- (lambda-var-fop-value lambda-var))))
- (if handle
- (when for-value-p
- (sb!fasl::dump-push handle *compile-object*))
- (progn
- ;; Undefined variable. Signal a warning, and
- ;; treat it as a special variable reference, like
- ;; the real compiler does -- do not elide even if
- ;; the value is unused.
- (note-undefined-reference form :variable)
- (fopcompile `(symbol-value ',form)
- path
- for-value-p)))))))))
+ (cond
+ ((eq :special kind)
+ ;; Special variable
+ (fopcompile `(symbol-value ',form) path for-value-p))
+
+ ((member kind '(:global :constant))
+ ;; Global variable or constant.
+ (fopcompile `(symbol-global-value ',form) path for-value-p))
+ (t
+ ;; Lexical
+ (let* ((lambda-var (cdr (assoc form (lexenv-vars *lexenv*))))
+ (handle (when lambda-var
+ (lambda-var-fop-value lambda-var))))
+ (if handle
+ (when for-value-p
+ (sb!fasl::dump-push handle *compile-object*))
+ (progn
+ ;; Undefined variable. Signal a warning, and
+ ;; treat it as a special variable reference, like
+ ;; the real compiler does -- do not elide even if
+ ;; the value is unused.
+ (note-undefined-reference form :variable)
+ (fopcompile `(symbol-value ',form)
+ path
+ for-value-p))))))))))
((listp form)
(multiple-value-bind (macroexpansion macroexpanded-p)
(sb!xc:macroexpand form *lexenv*)
(ignore-errors (delete-file fasl)))
(assert (= 1 *counter*))
(assert (= 1 (symbol-value '.counter-3.)))))
+
+(with-test (:name :defglobal-refers-to-defglobal)
+ (let ((fasl (compile-form `(progn
+ (defglobal **global-1** :fii)
+ (defglobal **global-2** **global-1**)))))
+ (load fasl)
+ (assert (eq (symbol-value '**global-1**) (symbol-value '**global-2**)))
+ (assert (eq :fii (symbol-value '**global-1**)))))