Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

fix CAS on DEFCAS-defined places when the form is a macro

  • Loading branch information...
1 parent ed46a50 commit 76db27f585eda84ab93411dd61b32677355f8cc4 @nikodemus nikodemus committed
Showing with 16 additions and 1 deletion.
  1. +2 −0  NEWS
  2. +1 −1  src/code/cas.lisp
  3. +13 −0 tests/compare-and-swap.impure.lisp
2  NEWS
@@ -11,6 +11,8 @@ changes relative to sbcl-1.0.58:
(lp#1023438, thanks to Robert Uhl)
* bug fix: SB-EXT:GET-CAS-EXPANSION returned a bogus read-form when given
a SYMBOL-VALUE form with a constant symbol argument.
+ * bug fix: SB-EXT:GET-CAS-EXPANSION signaled an error when a macro expanding
+ into a DEFCAS defined place was used as the place.
* documentation: a section on random number generation has been added to the
manual. (lp#656839)
2  src/code/cas.lisp
@@ -93,7 +93,7 @@ EXPERIMENTAL: Interface subject to change."
;; CAS expander.
- (funcall info place environment))
+ (funcall info expanded environment))
;; Structure accessor
((setf info (info :function :structure-accessor name))
13 tests/compare-and-swap.impure.lisp
@@ -412,3 +412,16 @@
(assert (eq :bar
(eval `(let (,@(mapcar 'list vars vals))
+(let ((foo (cons :foo nil)))
+ (defun cas-foo (old new)
+ (cas (cdr foo) old new)))
+(defcas foo () cas-foo)
+(with-test (:name :cas-and-macroexpansion)
+ (assert (not (cas (foo) nil t)))
+ (assert (eq t (cas (foo) t nil)))
+ (symbol-macrolet ((bar (foo)))
+ (assert (not (cas bar nil :ok)))
+ (assert (eq :ok (cas bar :ok nil)))
+ (assert (not (cas bar nil t)))))

0 comments on commit 76db27f

Please sign in to comment.
Something went wrong with that request. Please try again.