From a76ae2de6f6d81d3a774da2060844af08e705c95 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Fri, 31 Jul 2009 13:00:17 +0000 Subject: [PATCH] 1.0.30.26: fix failing AVER in CONVERT-MV-CALL See https://bugs.launchpad.net/sbcl/+bug/392203 Patch by Larry D'Anna. His comments: Ever since Spice Lisp, convert-mv-call had returned without doing anything if (functional-entry-fun fun) is not null, ie if fun possesses a XEP. 0.8.5.5 replaces this criterion with "if the last optional entry has references", and signals an error if the last optional entry has no references and the XEP exists. I can't know exactly what Alexy was thinking when he put the aver in, but I can guess: If the XEP exists it should contain a reference to the last entry point, so if the last entry point has no refs and a XEP exists something went wrong. However, if the number of required + optional arguments is 0, then XEP doesn't need the "last" entry point, it can always use the "more" entry point instead, which is exactly what seems to have happened in this case. This patch combines the two conditions. convert-mv-call will return without action if *either* a XEP exists, *or* the last optional entry has references." --- NEWS | 2 ++ src/compiler/locall.lisp | 4 ++-- tests/compiler.pure.lisp | 9 +++++++++ version.lisp-expr | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index d1b55bb..9988938 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,8 @@ changes relative to sbcl-1.0.30: well. * improvement: improved address space layout on OpenBSD (thanks to Josh Elsasser) + * bug fix: a failing AVER in CONVERT-MV-CALL has been fixed. (thanks to + Larry D'Anna) * bug fix: SLEEP supports times over 100 million seconds on long on OpenBSD as well. (reported by Josh Elsasser) * bug fix: DELETE-FILE on streams no longer closes the stream with :ABORT T, diff --git a/src/compiler/locall.lisp b/src/compiler/locall.lisp index b274db3..aa84315 100644 --- a/src/compiler/locall.lisp +++ b/src/compiler/locall.lisp @@ -472,13 +472,13 @@ (declare (type ref ref) (type mv-combination call) (type functional fun)) (when (and (looks-like-an-mv-bind fun) (singleton-p (leaf-refs fun)) - (singleton-p (basic-combination-args call))) + (singleton-p (basic-combination-args call)) + (not (functional-entry-fun fun))) (let* ((*current-component* (node-component ref)) (ep (optional-dispatch-entry-point-fun fun (optional-dispatch-max-args fun)))) (when (null (leaf-refs ep)) (aver (= (optional-dispatch-min-args fun) 0)) - (aver (not (functional-entry-fun fun))) (setf (basic-combination-kind call) :local) (sset-adjoin ep (lambda-calls-or-closes (node-home-lambda call))) (merge-tail-sets call ep) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 1c49450..c49d8c4 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -3211,3 +3211,12 @@ (test `(lambda (x) (declare (double-float x)) (* x 2)) 123.45d0 246.9d0) (test `(lambda (x) (declare (double-float x)) (* x 2.0)) 543.21d0 1086.42d0) (test `(lambda (x) (declare (double-float x)) (* x 2.0d0)) 42.0d0 84.0d0))) + +(with-test (:name :bug-392203) + ;; Used to hit an AVER in COMVERT-MV-CALL. + (assert (zerop + (funcall + (compile nil + `(lambda () + (flet ((k (&rest x) (declare (ignore x)) 0)) + (multiple-value-call #'k #'k)))))))) diff --git a/version.lisp-expr b/version.lisp-expr index f70c198..c308a2a 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.30.25" +"1.0.30.26" -- 1.7.10.4