Activity log for bug #2012010

Date Who What changed Old value New value Message
2023-03-17 00:08:20 Patrick Poitras bug added bug
2023-03-17 00:08:54 Patrick Poitras description Hi peeps! I come to you with a reproducible example of a typechecking problem we had. ``` (defun sad-function () (let* ((a (make-array 8 :element-type '(signed-byte 8) :initial-element -128)) (b (make-array 8 :element-type '(signed-byte 8) :initial-element 3))) (new-pmm-state-or! a b))) (defun print-row-major-arefs (v1 v2) (let ((a (sb-simd-avx2:s8.32-row-major-aref v1 0)) (b (sb-simd-avx2:s8.32-row-major-aref v2 0))) (format t "~A ~A" a b))) (sad-function) ``` This will print out whatever is in the registers at the time of the call. I think some information about the length of arrays passed into the second function is lost by passing it into a function, because if you inline the second function ``` (declaim (inline print-row-major-arefs)) (defun sad-function () (let* ((a (make-array 8 :element-type '(signed-byte 8) :initial-element -128)) (b (make-array 8 :element-type '(signed-byte 8) :initial-element 3))) (print-row-major-arefs a b))) (defun print-row-major-arefs (v1 v2) (let ((a (sb-simd-avx2:s8.32-row-major-aref v1 0)) (b (sb-simd-avx2:s8.32-row-major-aref v2 0))) (format t "~A ~A" a b))) (sad-function) ``` you get ``` Value of (- (ARRAY-TOTAL-SIZE ARRAY) 31) in (SB-KERNEL:CHECK-BOUND ARRAY (- (ARRAY-TOTAL-SIZE ARRAY) 31) SB-SIMD-INTERNALS::INDEX) is -23, not a (MOD 4611686018427387901). [Condition of type SIMPLE-TYPE-ERROR] ``` Which is a bit confusing of an error message, but it is crashing due to the size of the array being 24 elements too small. The uninlined call does not error out, and will in fact print out whatever values were in the registers. I'm not sure if the typecheck is intentional. It may be an unintentional typecheck error as a response to undefined behavior, that just happens to be helpful. Either way, I figured a minimally reproducible example might be helpful to y'all. SBCL version is 2.3.2. Running on Ubuntu 18, with AVX2 instructions. uname -a ```Linux <name> 5.15.1-1.el7.elrepo.x86_64 #1 SMP Thu Nov 4 19:11:12 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux``` *features* ```(:CLPM-CLIENT :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :ARENA-ALLOCATOR :X86-64 :GENCGC :64-BIT :ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-POINT :LINUX :LITTLE-ENDIAN :PACKAGE-LOCAL-NICKNAMES :SB-LDB :SB-PACKAGE-LOCKS :SB-THREAD :SB-UNICODE :SBCL :UNIX)``` Cheers! Hi peeps! I come to you with a reproducible example of a typechecking problem we had. ``` (defun sad-function ()   (let* ((a (make-array 8 :element-type '(signed-byte 8) :initial-element -128))          (b (make-array 8 :element-type '(signed-byte 8) :initial-element 3)))            (new-pmm-state-or! a b))) (defun print-row-major-arefs (v1 v2)   (let ((a (sb-simd-avx2:s8.32-row-major-aref v1 0))         (b (sb-simd-avx2:s8.32-row-major-aref v2 0)))     (format t "~A ~A" a b))) (sad-function) ``` This will print out whatever is in the registers at the time of the call. I think some information about the length of arrays passed into the second function is lost by passing it into a function, because if you inline the second function ``` (declaim (inline print-row-major-arefs)) (defun sad-function ()   (let* ((a (make-array 8 :element-type '(signed-byte 8) :initial-element -128))          (b (make-array 8 :element-type '(signed-byte 8) :initial-element 3)))            (print-row-major-arefs a b))) (defun print-row-major-arefs (v1 v2)   (let ((a (sb-simd-avx2:s8.32-row-major-aref v1 0))         (b (sb-simd-avx2:s8.32-row-major-aref v2 0)))     (format t "~A ~A" a b))) (sad-function) ``` you get ``` Value of (- (ARRAY-TOTAL-SIZE ARRAY) 31) in (SB-KERNEL:CHECK-BOUND ARRAY (- (ARRAY-TOTAL-SIZE ARRAY) 31)                        SB-SIMD-INTERNALS::INDEX) is   -23, not a   (MOD 4611686018427387901).    [Condition of type SIMPLE-TYPE-ERROR] ``` Which is a bit confusing of an error message, but it is crashing due to the size of the array being 24 elements too small. The uninlined call does not error out, and will in fact print out whatever values were in the registers. I'm not sure if the typecheck is intentional. It may be an unintentional typecheck error as a response to undefined behavior, that just happens to be helpful. Either way, I figured a minimally reproducible example might be helpful to y'all. SBCL version is 2.3.2. Running on Ubuntu 18, with AVX2 instructions. uname -a ``` Linux <name> 5.15.1-1.el7.elrepo.x86_64 #1 SMP Thu Nov 4 19:11:12 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux ``` *features* ``` (:CLPM-CLIENT :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX  :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :ARENA-ALLOCATOR :X86-64 :GENCGC :64-BIT  :ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-POINT :LINUX :LITTLE-ENDIAN  :PACKAGE-LOCAL-NICKNAMES :SB-LDB :SB-PACKAGE-LOCKS :SB-THREAD :SB-UNICODE  :SBCL :UNIX) ``` Cheers!
2023-03-17 15:35:35 Gaelen Marsden bug added subscriber Gaelen Marsden
2023-03-17 17:42:07 Patrick Poitras description Hi peeps! I come to you with a reproducible example of a typechecking problem we had. ``` (defun sad-function ()   (let* ((a (make-array 8 :element-type '(signed-byte 8) :initial-element -128))          (b (make-array 8 :element-type '(signed-byte 8) :initial-element 3)))            (new-pmm-state-or! a b))) (defun print-row-major-arefs (v1 v2)   (let ((a (sb-simd-avx2:s8.32-row-major-aref v1 0))         (b (sb-simd-avx2:s8.32-row-major-aref v2 0)))     (format t "~A ~A" a b))) (sad-function) ``` This will print out whatever is in the registers at the time of the call. I think some information about the length of arrays passed into the second function is lost by passing it into a function, because if you inline the second function ``` (declaim (inline print-row-major-arefs)) (defun sad-function ()   (let* ((a (make-array 8 :element-type '(signed-byte 8) :initial-element -128))          (b (make-array 8 :element-type '(signed-byte 8) :initial-element 3)))            (print-row-major-arefs a b))) (defun print-row-major-arefs (v1 v2)   (let ((a (sb-simd-avx2:s8.32-row-major-aref v1 0))         (b (sb-simd-avx2:s8.32-row-major-aref v2 0)))     (format t "~A ~A" a b))) (sad-function) ``` you get ``` Value of (- (ARRAY-TOTAL-SIZE ARRAY) 31) in (SB-KERNEL:CHECK-BOUND ARRAY (- (ARRAY-TOTAL-SIZE ARRAY) 31)                        SB-SIMD-INTERNALS::INDEX) is   -23, not a   (MOD 4611686018427387901).    [Condition of type SIMPLE-TYPE-ERROR] ``` Which is a bit confusing of an error message, but it is crashing due to the size of the array being 24 elements too small. The uninlined call does not error out, and will in fact print out whatever values were in the registers. I'm not sure if the typecheck is intentional. It may be an unintentional typecheck error as a response to undefined behavior, that just happens to be helpful. Either way, I figured a minimally reproducible example might be helpful to y'all. SBCL version is 2.3.2. Running on Ubuntu 18, with AVX2 instructions. uname -a ``` Linux <name> 5.15.1-1.el7.elrepo.x86_64 #1 SMP Thu Nov 4 19:11:12 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux ``` *features* ``` (:CLPM-CLIENT :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX  :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :ARENA-ALLOCATOR :X86-64 :GENCGC :64-BIT  :ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-POINT :LINUX :LITTLE-ENDIAN  :PACKAGE-LOCAL-NICKNAMES :SB-LDB :SB-PACKAGE-LOCKS :SB-THREAD :SB-UNICODE  :SBCL :UNIX) ``` Cheers! Hi peeps! I come to you with a reproducible example of a typechecking problem we had. ``` (defun sad-function ()   (let* ((a (make-array 8 :element-type '(signed-byte 8) :initial-element -128))          (b (make-array 8 :element-type '(signed-byte 8) :initial-element 3)))            (print-row-major-arefs a b))) (defun print-row-major-arefs (v1 v2)   (let ((a (sb-simd-avx2:s8.32-row-major-aref v1 0))         (b (sb-simd-avx2:s8.32-row-major-aref v2 0)))     (format t "~A ~A" a b))) (sad-function) ``` This will print out whatever is in the registers at the time of the call. I think some information about the length of arrays passed into the second function is lost by passing it into a function, because if you inline the second function ``` (declaim (inline print-row-major-arefs)) (defun sad-function ()   (let* ((a (make-array 8 :element-type '(signed-byte 8) :initial-element -128))          (b (make-array 8 :element-type '(signed-byte 8) :initial-element 3)))            (print-row-major-arefs a b))) (defun print-row-major-arefs (v1 v2)   (let ((a (sb-simd-avx2:s8.32-row-major-aref v1 0))         (b (sb-simd-avx2:s8.32-row-major-aref v2 0)))     (format t "~A ~A" a b))) (sad-function) ``` you get ``` Value of (- (ARRAY-TOTAL-SIZE ARRAY) 31) in (SB-KERNEL:CHECK-BOUND ARRAY (- (ARRAY-TOTAL-SIZE ARRAY) 31)                        SB-SIMD-INTERNALS::INDEX) is   -23, not a   (MOD 4611686018427387901).    [Condition of type SIMPLE-TYPE-ERROR] ``` Which is a bit confusing of an error message, but it is crashing due to the size of the array being 24 elements too small. The uninlined call does not error out, and will in fact print out whatever values were in the registers. I'm not sure if the typecheck is intentional. It may be an unintentional typecheck error as a response to undefined behavior, that just happens to be helpful. Either way, I figured a minimally reproducible example might be helpful to y'all. SBCL version is 2.3.2. Running on Ubuntu 18, with AVX2 instructions. uname -a ``` Linux <name> 5.15.1-1.el7.elrepo.x86_64 #1 SMP Thu Nov 4 19:11:12 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux ``` *features* ``` (:CLPM-CLIENT :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX  :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :ARENA-ALLOCATOR :X86-64 :GENCGC :64-BIT  :ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-POINT :LINUX :LITTLE-ENDIAN  :PACKAGE-LOCAL-NICKNAMES :SB-LDB :SB-PACKAGE-LOCKS :SB-THREAD :SB-UNICODE  :SBCL :UNIX) ``` Cheers!
2024-02-07 09:36:27 Stas Boukarev sbcl: status New Fix Committed
2024-02-29 08:12:13 Christophe Rhodes sbcl: status Fix Committed Fix Released