EVAL occasionally expands macros twice

Bug #541584 reported by Richard Holcombe on 2010-03-18
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Low
Unassigned

Bug Description

I execute the following code:

(defvar *arglist* nil)
(defmacro test2(x)
(progn
(push x *arglist*)
`(setf ,x 7)))

(test2 y)

then *arglist* has the value (y y) when just (y) is expected. (at least (y) is what I get on all of the other lisps that I can find, and makes much more sense.)

This occurs at least on versions 1.0.33 and 1.0.36 on linux.

uname -a
Linux 2.6.31-20-generic #58-Ubuntu SMP Fri Mar 12 05:23:09 UTC 2010 i686 GNU/Linux

*features*

(:ANSI-CL :COMMON-LISP :SBCL :SB-DOC :SB-TEST :SB-LDB :SB-PACKAGE-LOCKS
 :SB-UNICODE :SB-EVAL :SB-SOURCE-LOCATIONS :IEEE-FLOATING-POINT :X86 :UNIX :ELF
 :LINUX :SB-THREAD :LARGEFILE :GENCGC :STACK-GROWS-DOWNWARD-NOT-UPWARD
 :C-STACK-IS-CONTROL-STACK :COMPARE-AND-SWAP-VOPS :UNWIND-TO-FRAME-AND-CALL-VOP
 :RAW-INSTANCE-INIT-VOPS :STACK-ALLOCATABLE-CLOSURES :STACK-ALLOCATABLE-VECTORS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-FIXED-OBJECTS :ALIEN-CALLBACKS
 :CYCLE-COUNTER :INLINE-CONSTANTS :LINKAGE-TABLE :OS-PROVIDES-DLOPEN
 :OS-PROVIDES-PUTWC :OS-PROVIDES-SUSECONDS-T)

Changed in sbcl:
status: New → In Progress
Nikodemus Siivola (nikodemus) wrote :

Strictly speaking IIRC, macros are allowed to be expanded multiple times, what is going on here seems unintentional.

summary: - incorrect macro evaluation
+ EVAL occasionally expands macros twice
Changed in sbcl:
status: In Progress → Confirmed
Changed in sbcl:
importance: Undecided → Low
status: Confirmed → Triaged
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers