From 7f52216bc52c9ef90e08049f235bca0c34943690 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Wed, 27 Jul 2011 15:46:06 +0300 Subject: [PATCH] make sure LVAR-EXTERNALLY-CHECKABLE-TYPE always returns a type Fixes bug reported by Eric Marsden on sbcl-devel. --- NEWS | 2 ++ src/compiler/ir1opt.lisp | 2 +- tests/compiler.pure.lisp | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 13d8c9d..2d22de9 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ changes relative to sbcl-1.0.50: instructions. (lp#814688) * bug fix: COERCE to unfinalized extended sequence classes now works. (reported by Jan Moringen; lp#815155) + * bug fix: a compiler error during typecheck generation, reported by Eric + Marsden. changes in sbcl-1.0.50 relative to sbcl-1.0.49: * enhancement: errors from FD handlers now provide a restart to remove diff --git a/src/compiler/ir1opt.lisp b/src/compiler/ir1opt.lisp index 59b6bfd..5c4a4ae 100644 --- a/src/compiler/ir1opt.lisp +++ b/src/compiler/ir1opt.lisp @@ -222,7 +222,7 @@ it (coerce-to-values type))) (t (coerce-to-values type))))) dest))))) - (lvar-%externally-checkable-type lvar)) + (or (lvar-%externally-checkable-type lvar) *wild-type*)) #!-sb-fluid(declaim (inline flush-lvar-externally-checkable-type)) (defun flush-lvar-externally-checkable-type (lvar) (declare (type lvar lvar)) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index a9ad0d8..d88203e 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -3958,3 +3958,13 @@ (= #C(2d0 3d0) (the (complex double-float) x)))))) (assert (funcall foo #C(2d0 3d0))) (assert (not (funcall foo #C(1d0 2d0)))))) + +(with-test (:name :lvar-externally-checkable-type-nil) + ;; Used to signal a BUG during compilation. + (let ((fun (compile nil `(lambda (a) (parse-integer "12321321" (the (member :start) a) 1))))) + (multiple-value-bind (i p) (funcall fun :start) + (assert (= 2321321 i)) + (assert (= 8 p))) + (multiple-value-bind (i e) (ignore-errors (funcall fun :end)) + (assert (not i)) + (assert (typep e 'type-error))))) -- 1.7.10.4