- running the code in QEMU (to be fair, I haven't actually tried any other emulators/hardware)
- the code is compiled with -O2 or higher. If compiled with -O0 or -O1, no exception is raised.
The relevant code seems fairly innocuous - it's just filling values in an array of bitmaps:
Code: Select all
for (uint32_t i = 0; i < kNumBitmapEntries; i++) {
if (i > map_index) {
bitmaps[i] = ~0;
} else {
bitmaps[i] = 0;
}
}
Code: Select all
.LBB4_1:
movd %edx, %xmm4
pshufd $0, %xmm4, %xmm4
movdqa %xmm4, %xmm5
paddd %xmm1, %xmm5
paddd %xmm2, %xmm4
pxor %xmm3, %xmm5
pcmpgtd %xmm0, %xmm5
pxor %xmm3, %xmm4
pcmpgtd %xmm0, %xmm4
movdqu %xmm5, bitmaps(,%edx,4)
movdqu %xmm4, bitmaps+16(,%edx,4)
addl $8, %edx
cmpl $32768, %edx
jne .LBB4_1