Off-by-one (or, type mismatch) error in LOGTEST of fixnums
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Douglas Katzman |
Bug Description
In the following:
(defstruct bitsy
(fix 0 :type fixnum))
(defun s62 (x) (logtest (ash 1 62) (bitsy-fix (truly-the bitsy x))))
(s62 (make-bitsy :fix (ash 1 61)))
=> T
The last expression returns T when it should return NIL.
SBCL's version is "SBCL 2.1.5.173.
Uname -a: Linux rooty 5.12.14_1 #1 SMP 1625102948 x86_64 GNU/Linux
Features:
(:SWANK :QUICKLISP :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX
:NON-BASE-
:COMMON-LISP :ELF :IEEE-FLOATING-
:PACKAGE-
:SB-PACKAGE-LOCKS :SB-THREAD :SB-UNICODE :SBCL :UNIX)
Changed in sbcl: | |
status: | New → Fix Released |
The vop combining optimizer got confused which happens only when mixing a (signed-byte 64) operand and a fixnum, and (ash 1 62) exceeds a fixnum, so it has to be (signed-byte 64).