Incorrect evaluation order for POP
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
From the description of POP on CLHS:
"pop reads the value of place, remembers the car of the list which was retrieved, writes the cdr of the list back into the place, and finally yields the car of the originally retrieved list."
A survey of other Lisp implementations shows that this is typically done with a PROG1, as it was in SBCL originally:
(LET* ((#:NEW537 LIST))
(PROG1 (CAR #:NEW537) (SETQ #:NEW537 (CDR #:NEW537)) (SETQ LIST #:NEW537)))
Revision b910fe1f removed the PROG1, giving this expansion:
(LET* ((#:G540 LIST) (#:NEW539 (CDR #:G540)))
(SETQ LIST #:NEW539)
(CAR #:G540))
One could argue that "finally yields the 'car'" means "finally takes the 'car' of," however that would make "remembers the 'car'" a mistake. It's easier to suppose that there is no mistake, and that "the 'car'" = "the originally retrieved car"
Changed in sbcl: | |
status: | New → Fix Committed |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |