From: Juho S. <js...@us...> - 2007-08-21 05:18:45
|
Update of /cvsroot/sbcl/sbcl/tests In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23283/tests Modified Files: defstruct.impure.lisp Log Message: 1.0.8.44: Fix EQUALP on structures with raw slots * Old version was basically accessing raw slots with %INSTANCE-REF, and doing EQUALP on the results. This was most obviously wrong for raw slots that were larger than a word (double-floats on 32-bit platforms). Less obviously this is also wrong for some float corner-cases, like negative zeroes. * Add RAW-INSTANCE-SLOTS-EQUALP which instead grovels the layout for the slot definitions and determines the proper accessor functions for each slot from that. * Reported by Vjacheslav Fyodorov. Index: defstruct.impure.lisp =================================================================== RCS file: /cvsroot/sbcl/sbcl/tests/defstruct.impure.lisp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- defstruct.impure.lisp 1 Jul 2007 16:35:06 -0000 1.30 +++ defstruct.impure.lisp 21 Aug 2007 05:18:42 -0000 1.31 @@ -699,5 +699,19 @@ (sb-kernel:layout-invalid () :error2)))))) -;;; success -(format t "~&/returning success~%") +;; EQUALP didn't work for structures with float slots (reported by +;; Vjacheslav Fyodorov). +(defstruct raw-slot-equalp-bug + (b 0s0 :type single-float) + c + (a 0d0 :type double-float)) + +(with-test (:name raw-slot-equalp) + (assert (equalp (make-raw-slot-equalp-bug :a 1d0 :b 2s0) + (make-raw-slot-equalp-bug :a 1d0 :b 2s0))) + (assert (equalp (make-raw-slot-equalp-bug :a 1d0 :b 0s0) + (make-raw-slot-equalp-bug :a 1d0 :b -0s0))) + (assert (not (equalp (make-raw-slot-equalp-bug :a 1d0 :b 2s0) + (make-raw-slot-equalp-bug :a 1d0 :b 3s0)))) + (assert (not (equalp (make-raw-slot-equalp-bug :a 1d0 :b 2s0) + (make-raw-slot-equalp-bug :a 2d0 :b 2s0))))) |