From 66ee499237be5778b44b0d7b2de396562137228e Mon Sep 17 00:00:00 2001 From: Paul Khuong Date: Sat, 30 Mar 2013 19:22:46 +0100 Subject: [PATCH] Fix a compilation failure on svref of a symbol macro Introduced in 0892423b (faster SVREF and (SETF SVREF) compilation) Thanks to James M. Lawrence for the quick report, with a reduced test case. --- NEWS | 4 ++++ src/compiler/array-tran.lisp | 4 ++-- tests/compiler.pure.lisp | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 0774be8..0357268 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,8 @@ ;;;; -*- coding: utf-8; fill-column: 78 -*- +changes relative to sbcl-1.1.6 + * bug fix: svref/(setf svref) on symbol macros don't crash the compiler + anymore. (Minimal test case provided by James M. Lawrence on sbcl-devel) + changes in sbcl-1.1.6 relative to sbcl-1.1.5: * enhancement: the continuable error when defknown-ing over extant fndb entries can be ignored by passing :overwrite-fndb-silently t diff --git a/src/compiler/array-tran.lisp b/src/compiler/array-tran.lisp index a595e63..d70cdb5 100644 --- a/src/compiler/array-tran.lisp +++ b/src/compiler/array-tran.lisp @@ -1023,7 +1023,7 @@ (define-source-transform svref (vector index) (let ((elt-type (or (when (symbolp vector) (let ((var (lexenv-find vector vars))) - (when var + (when (lambda-var-p var) (type-specifier (array-type-declared-element-type (lambda-var-type var)))))) t))) @@ -1036,7 +1036,7 @@ (define-source-transform %svset (vector index value) (let ((elt-type (or (when (symbolp vector) (let ((var (lexenv-find vector vars))) - (when var + (when (lambda-var-p var) (type-specifier (array-type-declared-element-type (lambda-var-type var)))))) t))) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 833c5ee..1a4fc7d 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -4378,3 +4378,8 @@ (with-test (:name :second-open-coded) (let ((fun (compile nil `(lambda (x) (second x))))) (assert (not (ctu:find-named-callees fun))))) + +(with-test (:name :svref-of-symbol-macro) + (compile nil `(lambda (x) + (symbol-macrolet ((sv x)) + (values (svref sv 0) (setf (svref sv 0) 99)))))) -- 1.7.10.4