Comment 5 for bug 876376

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

This /is/ a valid SBCL bug none the less:

(defpackage :test
  (:use :cl)
  (:lock t))

(in-package :test)

(define-symbol-macro x 0)

(defun foo (x)
  (declare (optimize debug))
  (let ((y (* 2 x)))
    (declare (single-float y))
     y))

(in-package :cl-user)

(test::foo 1)

;; in the debugger
test::x

;; results in
; in: LAMBDA (#:G775)
; (SYMBOL-MACROLET ((TEST::X
; (SB-DI:DEBUG-VAR-VALUE
; '#<SB-DI::COMPILED-DEBUG-VAR TEST::X 0 {10036124B3}>
; #:G775)))
; TEST::X)
;
; caught WARNING:
; Compile-time package lock violation:
; Lock on package TEST violated when binding X as a local symbol-macro while in
; package COMMON-LISP-USER.
; See also:
; The SBCL Manual, Node "Package Locks"
;
; caught ERROR:
; Lock on package TEST violated when binding X as a local symbol-macro while in
; package COMMON-LISP-USER.
; See also:
; The SBCL Manual, Node "Package Locks"
;
; compilation unit finished
; caught 1 ERROR condition
; caught 1 WARNING condition

debugger invoked on a SB-INT:COMPILED-PROGRAM-ERROR:
  Execution of a form compiled with errors.
Form:
  (SYMBOL-MACROLET ((X
                   (DEBUG-VAR-VALUE
                    '#<COMPILED-DEBUG-VAR TEST::X 0 {10036124B3}> G775)))
  X)
Compile-time error:
  Lock on package TEST violated when binding X as a local symbol-macro while in
package COMMON-LISP-USER.
See also:
  The SBCL Manual, Node "Package Locks"

(defun foo (x)
  (