Skip to content

m-v-b: bug in the compiler

Problem is present in 13.5.1 as well.

Snippet:

% cat test.lisp
(defvar v1 nil)

(defun run-test ()
  (let ((share_t)
        (fst 'a))
    (format t "fst ~S~%" fst)
    (multiple-value-bind (v1 fst)
        (case share_t
          ((nil)
           (values v1 fst)))
      (format t "fst ~S~%" fst))))

% ecl
ECL (Embeddable Common-Lisp) 16.1.2 (git:UNKNOWN)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
Copyright (C) 2015 Daniel Kochmanski
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  
Top level in: #<process TOP-LEVEL>.
> (compile-file "test.lisp")

;;; Loading #P"/u/gildea/lib/ecl-16.1.2/cmp.fas"
;;;
;;; Compiling test.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; Compiling (DEFVAR V1 ...).
;;; Compiling (DEFUN RUN-TEST ...).
;;; End of Pass 1.
;;; Emitting code for RUN-TEST.
;;; Finished compiling test.lisp.
;;;
#P"/tmp/test.fas"
NIL
NIL
> (load "test.fas")

;;; Loading "/tmp/test.fas"
#P"/tmp/test.fas"
> (run-test)
fst A
fst NIL
NIL
> (run-test)
fst A
fst A
NIL
> 

Reported by Dan Gildea

Edited by Daniel Kochmański