Miscompilation of simple math code (segfault)

This case is minimized from xpm parser in McCLIM

(defun zoom ()
  (let* ((n 3)
         (w (/ n 3)))
    (1- (expt 2 w))))

(zoom)
ecl --eval '(load (compile-file "/tmp/zoom.lisp"))'
  • observed: the code in question segfaults when zoom is called
  • expected: return 1

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

     VERSION "24.5.10"
      VCS-ID "855f93431bab0e972fad816a8e0437afdc1de245"
          OS "Linux"
  OS-VERSION "6.17.9-1-default"
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-6
              :GRAY-STREAMS-MODULE :CDR-1 :CDR-5 :LINUX :FORMATTER :CDR-7 :ECL
              :COMMON :COMMON-LISP :ANSI-CL :FFI :PREFIXED-API :CDR-14
              :PACKAGE-LOCAL-NICKNAMES :CLOS :ECL-PDE :LONG-FLOAT :UNIX
              :THREADS :ECL-READ-WRITE-LOCK :BOEHM-GC :ECL-WEAK-HASH :DFFI
              :IEEE-FLOATING-POINT :FLOATING-POINT-EXCEPTIONS :LONG-LONG
              :LITTLE-ENDIAN :UINT8-T :UINT16-T :UINT32-T :UINT64-T
              :COMPLEX-FLOAT :DLOPEN :CMU-FORMAT :CLOS-STREAMS :UNICODE :X86_64)

This is a regression compared to the last release "24.5.10" where the code compiles and loads with success.

Next steps:

  • look at the produced C code and see what's wrong
  • bisect if it doesn't help to find the source of regression
Edited by Daniel Kochmański