From 71e56a3ec29476514c3cdf57a7ac60a3d9733f1d Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Sun, 29 Oct 2006 21:05:58 +0000 Subject: [PATCH] 0.9.18.15: fix adjust-array :fill-pointer buglet, plus housekeeping * Reported by Lars Brinkhoff: "An error of type error is signaled if fill-pointer is supplied and non-nil but array has no fill pointer." * Test-case. * Improve the localtime/gmtime KLUDGE for Windows: instead of flipping the sign of time, use zero -- still arbitrary, but slightly less so. "Where there timezones before 1970, geez!" * Oops! Broken test-case from 0.9.18.12 fixed. --- NEWS | 6 +++++- src/code/array.lisp | 6 +++++- src/runtime/time.c | 2 +- tests/array.pure.lisp | 11 +++++++++++ tests/compiler.test.sh | 3 ++- version.lisp-expr | 2 +- 6 files changed, 25 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 98e4471..d753a76 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,9 @@ changes in sbcl-0.9.19 (1.0.0?) relative to sbcl-0.9.18: declaration in a LET* was fixed. (reported by Kaersten Poeck) * bug fix: file compiler no longer confuses validated and already dumped structurres. (reported by Kaersten Poeck) + * bug fix: ADJUST-ARRAY :FILL-POINTER T on an array without a + fill-pointer signals a type-error as required. (thanks to + Lars Brinkhoff) * improvements to the Windows port: ** floating point exceptions are now reported correctly. ** stack exhaustion detection works partially. @@ -16,7 +19,8 @@ changes in sbcl-0.9.19 (1.0.0?) relative to sbcl-0.9.18: process. ** PROBE-FILE now simplifies pathnames correctly. ** DIRECTORY now works correctly with :WILD-INFERIORS. - ** (DECODE-UNIVERSAL-TIME 0) works. + ** DECODE-UNIVERSAL-TIME works on times before 00:00:00 January + 1st 1970 (although time timezone data will be unreliable). changes in sbcl-0.9.18 (1.0.beta?) relative to sbcl-0.9.17: * enhancement: SB-POSIX now supports cfsetispeed(3), cfsetospeed(3), diff --git a/src/code/array.lisp b/src/code/array.lisp index a3c6793..308b762 100644 --- a/src/code/array.lisp +++ b/src/code/array.lisp @@ -764,7 +764,11 @@ of specialized arrays is supported." (error "The number of dimensions not equal to rank of array.")) ((not (subtypep element-type (array-element-type array))) (error "The new element type, ~S, is incompatible with old type." - element-type))) + element-type)) + ((and fill-pointer (not (array-has-fill-pointer-p array))) + (error 'type-error + :datum array + :expected-type '(satisfies array-has-fill-pointer-p)))) (let ((array-rank (length (the list dimensions)))) (declare (fixnum array-rank)) (unless (= array-rank 1) diff --git a/src/runtime/time.c b/src/runtime/time.c index 59a6fff..82ffab2 100644 --- a/src/runtime/time.c +++ b/src/runtime/time.c @@ -32,7 +32,7 @@ void get_timezone(time_t when, int *secwest, boolean *dst) * The Windows versions also don't support times before the * epoch, so we kludge it. */ if (when < 0) - when = -when; + when = 0; ltm = *localtime(&when); gtm = *gmtime(&when); #else diff --git a/tests/array.pure.lisp b/tests/array.pure.lisp index a44193b..f8ed9f5 100644 --- a/tests/array.pure.lisp +++ b/tests/array.pure.lisp @@ -209,3 +209,14 @@ collect (logand 1 (funcall lf (aref v1 i) (aref v2 i)))) 'bit-vector) do (assert (bit-vector-equal r1 r2))))) + +;;; CLHS, ADJUST-ARRAY: An error of type error is signaled if +;;; fill-pointer is supplied and non-nil but array has no fill pointer. +(assert (eq :good + (handler-case + (let ((array (make-array 12))) + (assert (not (array-has-fill-pointer-p array))) + (adjust-array array 12 :fill-pointer t) + array) + (type-error () + :good)))) diff --git a/tests/compiler.test.sh b/tests/compiler.test.sh index f7c9218..5b891d2 100644 --- a/tests/compiler.test.sh +++ b/tests/compiler.test.sh @@ -365,7 +365,8 @@ cat > $tmpfilename <