Incorrect evaluation order for POP

Bug #1454021 reported by Douglas Katzman on 2015-05-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
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"

Douglas Katzman (dougk) on 2015-05-12
Changed in sbcl:
status: New → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers