Merge branch 'fix-233-mvb-bug' into 'develop'

Fix 233 mvb bug

Closes #233

See merge request !77
This commit is contained in:
Fabrizio 2017-07-02 21:55:07 +00:00
commit 261f41fb19
3 changed files with 39 additions and 27 deletions

View file

@ -274,7 +274,7 @@ ecl_new_binding_index(cl_env_ptr env, cl_object symbol)
symbol->symbol.binding = new_index;
symbol->symbol.dynamic |= 1;
}
si_set_finalizer(symbol, ECL_T);
ecl_set_finalizer_unprotected(symbol, ECL_T);
return new_index;
}

View file

@ -29,39 +29,21 @@
ffi mop run-program))
;;; Some syntactic sugar for 2am
(defmacro once-only (specs &body body)
"Once-Only ({(Var Value-Expression)}*) Form*
Create a Let* which evaluates each Value-Expression, binding a
temporary variable to the result, and wrapping the Let* around the
result of the evaluation of Body. Within the body, each Var is
bound to the corresponding temporary variable."
(labels ((frob (specs body)
(if (null specs)
`(progn ,@body)
(let ((spec (first specs)))
(when (/= (length spec) 2)
(error "Malformed Once-Only binding spec: ~S." spec))
(let ((name (first spec))
(exp-temp (gensym)))
`(let ((,exp-temp ,(second spec))
(,name (gensym "OO-")))
`(let ((,,name ,,exp-temp))
,,(frob (rest specs) body))))))))
(frob specs body)))
(defmacro is-true (form)
`(is (eql ,form t) "Expected T, but got ~s" ,form))
(ext:once-only (form)
`(is (eql ,form t) "Expected T, but got ~s" ,form)))
(defmacro is-false (form)
`(is (null ,form) "Expected NIL, but got ~s" ,form))
(ext:once-only (form)
`(is (null ,form) "Expected NIL, but got ~s" ,form)))
(defmacro is-equal (what form)
`(is (equal ,what ,form) "EQUAL: ~s to ~s" ,form ,what))
(ext:once-only (what form)
`(is (equal ,what ,form) "EQUAL: ~s to ~s" ,what ,form)))
(defmacro is-eql (what form)
`(is (eql ,what ,form) "EQL: ~s to ~s" ,what ,form))
(ext:once-only (what form)
`(is (eql ,what ,form) "EQL: ~s to ~a" ,what ,form)))
(defmacro pass (form &rest args)
(declare (ignore form args))
@ -119,6 +101,10 @@ as a second value."
(*compile-verbose* t)
(*compile-print* t))
(setf compiled-file (compile-file ,filename ,@compiler-args))))))
;; todo: add delete-files flag
;; (when delete-files
;; (delete-file filename)
;; (delete-file compiled-file))
(values compiled-file output))))
(defmacro with-temporary-file ((var string &rest args) &body body)

View file

@ -225,3 +225,29 @@
(go :next)
(print 'skip)
:next))))
;;; Data: 2017-07-02
;;; Description:
;;;
;;; Function `ecl_new_binding_index' called `si_set_finalizer',
;;; which resetted `env->nvalues' leading to invalid binding in mvb
;;; during the first function run.
;;;
;;; Bug: https://gitlab.com/embeddable-common-lisp/ecl/issues/233
(test mix.0015.mvb
(with-compiler ("aux-cl-0003.lsp" :load t)
`(progn
(defvar mix.0015.v1 'booya)
(defun mix.0015.fun ()
(let ((share_t))
(multiple-value-bind (mix.0015.v1 woops)
(case share_t
((nil)
(values 1 2)))
woops)))))
(ignore-errors
(delete-file "aux-cl-0003.lsp")
(delete-file "aux-cl-0003.fas")
(delete-file "aux-cl-0003.fasc"))
(is-eql 2 (mix.0015.fun)))