Invalid substructure coalescing in COMPILE-FILE?
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
For a file bla.lisp with content
(defun x ()
(rest '(a (&rest x . #1=(&rest y)) #1# a)))
(defun y ()
(rest '(b (&rest x . #1=(&rest y)) #1# b)))
(defun z ()
(rest '(c (&rest x . #1=(&rest y)) #1# c)))
(let ((x (x)) (y (y)) (z (z)))
(format t "~3S ~S [~X] ~S [~X]~@
~3S ~S [~X] ~S [~X]~@
~3S ~S [~X] ~S [~X]~%"
(eq (cddr (car x)) (cadr x)) (car x) (sb-kernel:
(eq (cddr (car y)) (cadr y)) (car y) (sb-kernel:
(eq (cddr (car z)) (cadr z)) (car z) (sb-kernel:
when I execute (I tried two newer SBCL versions as well, with the same result)
> uname -a
Linux al 6.1.0-9-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.27-1 (2023-05-08) x86_64 GNU/Linux
> sbcl --version
SBCL 2.2.9.debian
> sbcl --noinform --no-userinit --eval '(print *features*)' --quit
(:X86-64 :GENCGC :64-BIT :ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-
:LITTLE-ENDIAN :PACKAGE-
:SB-
> sbcl --noinform --no-userinit --eval '(progn (compile-file "/tmp/bla.lisp") (load "/tmp/bla.fasl"))' --quit
; compiling file "/tmp/bla.lisp" (written 26 JUN 2023 08:43:19 PM):
; wrote /tmp/bla.fasl
; compilation finished in 0:00:00.008
T (&REST X &REST Y) [1001565447] (&REST Y) [1001565427]
NIL (&REST X &REST Y) [1001565447] (&REST Y) [10015654A7]
NIL (&REST X &REST Y) [1001565447] (&REST Y) [10015654A7]
I expect all three EQ calls to return true. Instead, only the first call returns true. It is also surprising that the return values are different between the three calls.
I believe this behavior violates "The file compiler is required to preserve eqlness of substructures within a file. Preserving eqlness means that subobjects that are the same in the source code must be the same in the corresponding compiled code." in https:/
Changed in sbcl: | |
status: | New → Confirmed |
assignee: | nobody → Stas Boukarev (stassats) |
Changed in sbcl: | |
assignee: | Stas Boukarev (stassats) → nobody |
status: | Confirmed → Fix Committed |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |