From 999f96be00309bf75534a1491f8ee14b610d6e88 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Wed, 20 Dec 2017 20:06:45 +0300 Subject: [PATCH] Fix the COERCE source transform. Don't call CSUBTYPEP on NIL which CAREFUL-SPECIFIER-TYPE may return. Fixes lp#1739450 --- src/compiler/array-tran.lisp | 3 ++- tests/compiler-2.pure.lisp | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/compiler/array-tran.lisp b/src/compiler/array-tran.lisp index e15554dd2..b6a8d75d0 100644 --- a/src/compiler/array-tran.lisp +++ b/src/compiler/array-tran.lisp @@ -582,7 +582,8 @@ (let* ((type (constant-form-value type env)) (length (1- (length x))) (ctype (careful-values-specifier-type type))) - (if (csubtypep ctype (specifier-type '(array * (*)))) + (if (and ctype + (csubtypep ctype (specifier-type '(array * (*))))) (multiple-value-bind (type element-type upgraded had-dimensions) (simplify-vector-type ctype) (declare (ignore type upgraded)) diff --git a/tests/compiler-2.pure.lisp b/tests/compiler-2.pure.lisp index 05b47d83e..0bec9d18b 100644 --- a/tests/compiler-2.pure.lisp +++ b/tests/compiler-2.pure.lisp @@ -860,3 +860,10 @@ (checked-compile `(lambda () (the (array abc) #())) :allow-style-warnings t)))) + +(with-test (:name (coerce :bad-type-specifier)) + (assert + (nth-value 1 + (checked-compile + `(lambda () (coerce (list 2) 1)) + :allow-warnings t)))) -- 2.11.4.GIT