diff --git a/src/c/stacks.d b/src/c/stacks.d index e74e7efbd..ce3e74a03 100644 --- a/src/c/stacks.d +++ b/src/c/stacks.d @@ -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; } diff --git a/src/tests/ecl-tests.lisp b/src/tests/ecl-tests.lisp index cf6835517..97223ff82 100644 --- a/src/tests/ecl-tests.lisp +++ b/src/tests/ecl-tests.lisp @@ -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) diff --git a/src/tests/normal-tests/mixed.lsp b/src/tests/normal-tests/mixed.lsp index f2ddf9a73..18e49f770 100644 --- a/src/tests/normal-tests/mixed.lsp +++ b/src/tests/normal-tests/mixed.lsp @@ -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)))