From b2d132a93d1fb2980b296fb0ae789580eae6691c Mon Sep 17 00:00:00 2001 From: Paul Khuong Date: Sun, 30 Oct 2011 02:42:15 -0400 Subject: [PATCH] Fix constant character comparisons for SPARC/sb-unicode SPARC only supports (SIGNED-BYTE 13) for literal values. Only emit comparison with literal characters up to (CODE-CHAR 4095). Reported by Eric Marsden on sbcl-devel. Fixes lp#883519. --- NEWS | 3 +++ src/compiler/sparc/char.lisp | 2 +- tests/compiler.pure.lisp | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index d9a4ff9..bdc57a6 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,9 @@ changes relative to sbcl-1.0.52: * bug fix: low-level control flow optimisations could result in bogus code in functions with tail and non-tail calls to local functions on x86oids. (lp#883500) + * bug fix: on SPARC/:sb-unicode, avoid crashing the assembler by trying + to emit literal characters > (code-char 4095), for comparisons with + constant characters. changes in sbcl-1.0.52 relative to sbcl-1.0.51: * enhancement: ASDF has been updated to version 2.017. diff --git a/src/compiler/sparc/char.lisp b/src/compiler/sparc/char.lisp index b3c6408..1f6a146 100644 --- a/src/compiler/sparc/char.lisp +++ b/src/compiler/sparc/char.lisp @@ -132,7 +132,7 @@ (define-vop (character-compare/c) (:args (x :scs (character-reg))) - (:arg-types character (:constant character)) + (:arg-types character (:constant (character-set ((0 . 4095))))) (:conditional) (:info target not-p y) (:policy :fast-safe) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index f13a4a1..73cc33d 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -4021,3 +4021,10 @@ (declare (optimize (speed 0))) (mod (mod a (min -5 a)) 5))) 1)) + +;; Test for literals too large for the ISA (e.g. (SIGNED-BYTE 13) on SPARC). +#+sb-unicode +(with-test (:name :bug-883519) + (compile nil `(lambda (x) + (declare (type character x)) + (eql x #\U0010FFFF)))) -- 1.7.10.4