From ef5fdd6fc577298d1cef8eb97de5f577e30dd642 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Tue, 5 May 2009 09:41:24 +0000 Subject: [PATCH] 1.0.28.12: preserve non-toplevelness of macro subforms * As per CLHS 3.2.3.1.2. At least AND, OR, and COND where affected by this. Reported by James Knight. --- NEWS | 3 +++ src/code/defboot.lisp | 12 +++++++++--- tests/compiler.test.sh | 7 +++++++ version.lisp-expr | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 7f2c767..728ef57 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,9 @@ * optimization: multidimensional array accesses in the absence of type information regarding array rank are approximately 10% faster due to open coding of ARRAY-RANK. + * bug fix: some forms of AND, OR, and COND resulted in expansions that could + result in their subforms being treated as top level forms. (reported by + James Knight) * bug fix: disable address space randomization Linux/x86-64 as well, not just x86-64. (reported by Ken Olum) * bug fix: #201; type inference for CONS and ARRAY types could derive diff --git a/src/code/defboot.lisp b/src/code/defboot.lisp index 581c994..6642fc2 100644 --- a/src/code/defboot.lisp +++ b/src/code/defboot.lisp @@ -82,7 +82,9 @@ ,n-result (cond ,@more)))) (if (eq t test) - `(progn ,@forms) + ;; THE to perserve non-toplevelness for FOO in + ;; (COND (T (FOO))) + `(the t (progn ,@forms)) `(if ,test (progn ,@forms) ,(when more `(cond ,@more)))))))))) @@ -101,7 +103,9 @@ evaluated as a PROGN." (defmacro-mundanely and (&rest forms) (cond ((endp forms) t) - ((endp (rest forms)) (first forms)) + ((endp (rest forms)) + ;; Preserve non-toplevelness of the form! + `(the t ,(first forms))) (t `(if ,(first forms) (and ,@(rest forms)) @@ -109,7 +113,9 @@ evaluated as a PROGN." (defmacro-mundanely or (&rest forms) (cond ((endp forms) nil) - ((endp (rest forms)) (first forms)) + ((endp (rest forms)) + ;; Preserve non-toplevelness of the form! + `(the t ,(first forms))) (t (let ((n-result (gensym))) `(let ((,n-result ,(first forms))) diff --git a/tests/compiler.test.sh b/tests/compiler.test.sh index 0a479eb..6a816df 100644 --- a/tests/compiler.test.sh +++ b/tests/compiler.test.sh @@ -398,5 +398,12 @@ cat > $tmpfilename < $tmpfilename <