From a74b61e0469b5954e48600600c0b7b7fe4ff46f8 Mon Sep 17 00:00:00 2001 From: Alexey Dejneka Date: Tue, 18 Jan 2005 04:34:55 +0000 Subject: [PATCH] 0.8.18.35: * Fix overflow in DATA-VECTOR-SET-C VOPs for simple bit vectors on X86 (reported by Timmy Douglas). --- NEWS | 2 ++ src/compiler/x86/array.lisp | 2 +- tests/compiler.pure.lisp | 16 ++++++++++++++++ version.lisp-expr | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index ac0ca2e..0d05ab9 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,8 @@ changes in sbcl-0.8.19 relative to sbcl-0.8.18: * bug fixed: functions with &REST arguments sometimes failed with "Undefined function" when compiled with (DEBUG 3). (reported by Robert J. Macomber) + * bug fix: overflow during compiling of setting element of a bit + vector with constant index and value. (reported by Timmy Douglas) * build fix: fixed the dependence on *LOAD-PATHNAME* and *COMPILE-FILE-PATHNAME* being absolute pathnames. * on x86 compiler partially supports stack allocation of dynamic-extent diff --git a/src/compiler/x86/array.lisp b/src/compiler/x86/array.lisp index a0983c2..2cd1d08 100644 --- a/src/compiler/x86/array.lisp +++ b/src/compiler/x86/array.lisp @@ -260,7 +260,7 @@ (mask ,(1- (ash 1 bits))) (shift (* extra ,bits))) (unless (= value mask) - (inst and old (lognot (ash mask shift)))) + (inst and old (ldb (byte 32 0) (lognot (ash mask shift))))) (unless (zerop value) (inst or old (ash value shift))))) (unsigned-reg diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index 6dd5498..b9dacd9 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -1675,3 +1675,19 @@ (with-simple-restart (blah "blah") (error "blah")))))) (handler-bind ((error (lambda (c) (invoke-restart 'blah)))) (assert (equal (multiple-value-list (funcall f)) '(nil t))))) + +;;; Bug reported by Timmy Douglas: overflow in bit vector setter with +;;; constant index and value. +(let* ((n (* 2 sb-vm::n-word-bits)) + (array1 (make-array n :element-type 'bit)) + (array2 (make-array n :element-type 'bit))) + (dotimes (i n) + (dotimes (v 2) + (let ((f (compile nil `(lambda (a) + (declare (type (simple-array bit (,n)) a)) + (setf (bit a ,i) ,v))))) + (fill array1 (- 1 v)) + (fill array2 (- 1 v)) + (funcall f array1) + (setf (aref array2 i) v) + (assert (equal array1 array2)))))) diff --git a/version.lisp-expr b/version.lisp-expr index 518eb48..4dc871a 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.18.34" +"0.8.18.35" -- 1.7.10.4