GET-CAS-EXPANSION of SYMBOL-VALUE buggy for quoted symbol
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The DEFINE-CAS-EXPANDER in 'late-cas.lisp' has an optimization that goes awry.
Assume that the symbol FROB has not been proclaimed special or global.
(get-cas-expansion '(symbol-value 'frob)) =>
NIL
NIL
#:OLD632
#:NEW633
(LOCALLY
(DECLARE (SYMBOL NIL))
(SB-INT:
(SB-KERNEL:
(SYMBOL-
Problems illustrated:
1a. The type-check eschews use of (THE <type> new), deferring to ABOUT-TO-MODIFY, but passes NIL instead of 'FROB
b. The update form passes NIL to %COMPARE-AND-SWAP. (These are the same problem obviously)
2. The volatile read uses SYMBOL-GLOBAL-VALUE but that's not right because CAS swaps the dynamic binding per this example:
* (defvar x "hi")
* (progn (let ((x 9)) (print (cas (symbol-value 'x) 9 12)) (print x)) x)
prints 9, 12, "hi"
Compare to otherwise correct expansion, barring the last return value, for a non-constant symbol:
* (get-cas-expansion '(symbol-value x)) =>
(#:X637)
(X)
#:OLD638
#:NEW639
(LOCALLY
(DECLARE (SYMBOL #:X637))
(SB-INT:
(SB-KERNEL:
(SYMBOL-
Tested in SBCL 1.1.3.3-c8fedad
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
In fa52f5ce506a4df 5fa6b493dd33e1f eab874f4a9.