Skip to content

EQness lost

The following definition of FOO has shared structure (see #1 and #1#). But that sharing does not survive compilation.

$ cat x.lisp
(defun foo ()
  '(0)
  (let ((x #1='(0))
        (y (second '#1#)))
    (assert (equal x '(0)))
    (assert (equal y '(0)))
    (assert (eq x y))))
> (load (compile-file "x.lisp"))

;;;
;;; Compiling x.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; End of Pass 1.
;;; Finished compiling x.lisp.
;;;
#P"<snip>/x.fas"
> (foo)

Condition of type: SIMPLE-TYPE-ERROR
The assertion (EQ X Y) failed

I would expect the EQ assertion to hold.

Provide details regarding ECL version (or preferably commit), operating system and if revelant the build options and versions of the build tools.

     VERSION "20.4.24"
      VCS-ID "UNKNOWN"
          OS "Linux"
  OS-VERSION "5.10.46-5rodete1-amd64"
MACHINE-TYPE "x86_64"
    FEATURES (:QUICKLISP :ASDF-PACKAGE-SYSTEM :ASDF3.1 :ASDF3 :ASDF2 :ASDF
              :OS-UNIX :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :WALKER :CDR-1
              :CDR-5 :LINUX :FORMATTER :CDR-7 :ECL-WEAK-HASH :LITTLE-ENDIAN
              :ECL-READ-WRITE-LOCK :LONG-LONG :UINT64-T :UINT32-T :UINT16-T
              :COMPLEX-FLOAT :LONG-FLOAT :UNICODE :DFFI :CLOS-STREAMS
              :CMU-FORMAT :UNIX :ECL-PDE :DLOPEN :CLOS :THREADS :BOEHM-GC
              :ANSI-CL :COMMON-LISP :FLOATING-POINT-EXCEPTIONS
              :IEEE-FLOATING-POINT :PACKAGE-LOCAL-NICKNAMES :CDR-14
              :PREFIXED-API :FFI :X86_64 :COMMON :ECL)
Edited by Gábor Melis