From f399a6fcad06989b7cb70c00fc7a4a4850a22ab8 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Tue, 13 Aug 2002 11:45:40 +0000 Subject: [PATCH] 0.7.6.18: SYMBOL-MACROLET fixes ... throw a COMPILER-ERROR when attempting to bind a special or a constant with SYMBOL-MACROLET ... throw a PROGRAM-ERROR when attempting to run a form compiled with errors (thanks to Raymond Toy and Eric Marsden for their work on the CMUCL side) --- BUGS | 13 ------------- src/compiler/ir1-translators.lisp | 3 +++ src/compiler/ir1tran.lisp | 5 +++-- src/compiler/main.lisp | 5 +++-- tests/compiler.impure.lisp | 19 +++++++++++++++++++ version.lisp-expr | 2 +- 6 files changed, 29 insertions(+), 18 deletions(-) diff --git a/BUGS b/BUGS index be699cd..af81ba1 100644 --- a/BUGS +++ b/BUGS @@ -288,10 +288,6 @@ WORKAROUND: 48: SYMBOL-MACROLET bugs reported by Peter Van Eynde July 25, 2000: - a: (SYMBOL-MACROLET ((T TRUE)) ..) should probably signal - PROGRAM-ERROR, but SBCL accepts it instead. - b: SYMBOL-MACROLET should refuse to bind something which is - declared as a global variable, signalling PROGRAM-ERROR. c: SYMBOL-MACROLET should signal PROGRAM-ERROR if something it binds is declared SPECIAL inside. @@ -623,15 +619,6 @@ WORKAROUND: the first time around, until regression tests are written I'm not comfortable merging the patches in the CVS version of SBCL. -102: - As reported by Arthur Lemmens sbcl-devel 2001-05-05, ANSI - requires that SYMBOL-MACROLET refuse to rebind special variables, - but SBCL doesn't do this. (Also as reported by AL in the same - message, SBCL depended on this nonconforming behavior to build - itself, because of the way that **CURRENT-SEGMENT** was implemented. - As of sbcl-0.7.3.x, this dependence on the nonconforming behavior - has been fixed, but the nonconforming behavior remains.) - 104: (DESCRIBE 'SB-ALIEN:DEF-ALIEN-TYPE) reports the macro argument list incorrectly: diff --git a/src/compiler/ir1-translators.lisp b/src/compiler/ir1-translators.lisp index c8eb5e9..c06a99b 100644 --- a/src/compiler/ir1-translators.lisp +++ b/src/compiler/ir1-translators.lisp @@ -302,6 +302,9 @@ (compiler-error "The local symbol macro name ~S is not a symbol." name)) + (let ((kind (info :variable :kind name))) + (when (member kind '(:special :constant)) + (compiler-error "Attempt to bind a ~(~A~) variable with SYMBOL-MACROLET: ~S" kind name))) `(,name . (MACRO . ,expansion)))) :vars definitions diff --git a/src/compiler/ir1tran.lisp b/src/compiler/ir1tran.lisp index 579e41d..269345d 100644 --- a/src/compiler/ir1tran.lisp +++ b/src/compiler/ir1tran.lisp @@ -428,8 +428,9 @@ cont form &optional - (proxy ``(error "execution of a form compiled with errors:~% ~S" - ',,form))) + (proxy ``(error 'simple-program-error + :format-control "execution of a form compiled with errors:~% ~S" + :format-arguments (list ',,form)))) &body body) (let ((skip (gensym "SKIP"))) `(block ,skip diff --git a/src/compiler/main.lisp b/src/compiler/main.lisp index 55be15e..88b0488 100644 --- a/src/compiler/main.lisp +++ b/src/compiler/main.lisp @@ -1000,8 +1000,9 @@ (*compiler-error-bailout* (lambda () (convert-and-maybe-compile - `(error "execution of a form compiled with errors:~% ~S" - ',form) + `(error 'simple-program-error + :format-control "execution of a form compiled with errors:~% ~S" + :format-arguments (list ',form)) path) (throw 'process-toplevel-form-error-abort nil)))) diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index db08b0d..7806b50 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -160,6 +160,25 @@ ;; a call to prevent the other arguments from being optimized away (logand a1 a2 a3 a4 a5 a6 a7 a8 a9))) +;;; BUG 48a. and b. (symbol-macrolet handling), fixed by Eric Marsden +;;; and Raymond Toy for CMUCL, fix ported for sbcl-0.7.6.18. +(multiple-value-bind (function warnings-p failure-p) + (compile nil '(lambda () (symbol-macrolet ((t nil)) t))) + (assert failure-p) + (assert (raises-error? (funcall function) program-error))) + +(multiple-value-bind (function warnings-p failure-p) + (compile nil '(lambda () (symbol-macrolet ((*standard-input* nil)) *standard-input*))) + (assert failure-p) + (assert (raises-error? (funcall function) program-error))) +#| +BUG 48c, not yet fixed: +(multiple-value-bind (function warnings-p failure-p) + (compile nil '(lambda () (symbol-macrolet ((s nil)) (declare (special s)) s))) + (assert failure-p) + (assert (raises-error? (funcall function) program-error))) +|# + ;;;; tests not in the problem domain, but of the consistency of the ;;;; compiler machinery itself diff --git a/version.lisp-expr b/version.lisp-expr index 1254533..f99bf07 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; for internal versions, especially for internal versions off the ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.7.6.17" +"0.7.6.18" -- 1.7.10.4