From f3839de6871d7d90bfea2d8f2c5a42d09b49a631 Mon Sep 17 00:00:00 2001 From: Paul Khuong Date: Tue, 2 Dec 2008 04:36:13 +0000 Subject: [PATCH] 1.0.23.11: Typecheck late-bound calls too * Ensures that the compiler can't be confused into IR2 converting bad `late-bound' calls like (funcall 'cons 1). Reported by madnificient on #lisp --- src/compiler/ir1tran.lisp | 13 +++++++------ tests/compiler.pure.lisp | 6 ++++++ version.lisp-expr | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/compiler/ir1tran.lisp b/src/compiler/ir1tran.lisp index e674c9d61..ca8904d89 100644 --- a/src/compiler/ir1tran.lisp +++ b/src/compiler/ir1tran.lisp @@ -116,12 +116,13 @@ (make-global-var :kind :global-function :%source-name name - :type (if (and (not latep) - (or *derive-function-types* - (member where '(:declared :defined-method)) - (and (member name *fun-names-in-this-file* - :test #'equal) - (not (fun-lexically-notinline-p name))))) + :type (if (or (eq where :declared) + (and (not latep) + (or *derive-function-types* + (eq where :defined-method) + (and (not (fun-lexically-notinline-p name)) + (member name *fun-names-in-this-file* + :test #'equal))))) (progn (maybe-update-info-for-gf name) (info :function :type name)) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 34aa2a061..16eeee447 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -2664,3 +2664,9 @@ i) i)))))) (assert (equal '(1 2 1) (funcall fun 1)))))) + +;;; It used to be possible to confuse the compiler into +;;; IR2-converting such a call to CONS +(with-test (:name :late-bound-primitive) + (compile nil `(lambda () + (funcall 'cons 1)))) diff --git a/version.lisp-expr b/version.lisp-expr index d305c63fd..a1aa72099 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.23.10" +"1.0.23.11" -- 2.11.4.GIT