Ptr.double broken for >2 GB?

Hello,

May it be, that ptr.Double doesn’t work for > 2 GB!?

Process 18511 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x100a9be80)
    frame #0: 0x000000010019add8 WorkerTest`Window1.Window1.openHugeViewBtn_Action%%o<Window1.Window1>o<PushButton> + 2712
WorkerTest`Window1.Window1.openHugeViewBtn_Action%%o<Window1.Window1>o<PushButton>:
->  0x10019add8 <+2712>: movsd  (%rax,%rdx), %xmm0        ; xmm0 = mem[0],zero 
    0x10019addd <+2717>: movsd  %xmm0, -0x148(%rbp)
    0x10019ade5 <+2725>: movsd  %xmm0, -0xe8(%rbp)
    0x10019aded <+2733>: jmp    0x10019aefe               ; <+3006>
Target 0: (WorkerTest) stopped.
(lldb) reg read
General Purpose Registers:
       rax = 0x0000000180000000
       rbx = 0x00000001689267f0
       rcx = 0x0000000080a9be80
       rdx = 0xffffffff80a9be80
       rdi = 0x00000001007d7790  XojoFramework`gCurrentException
       rsi = 0x00007fffffe00050
       rbp = 0x00007ffeefbfe940
       rsp = 0x00007ffeefbfe690
        r8 = 0x000000000000006d
        r9 = 0x0000000000000040
       r10 = 0x0000000000000000
       r11 = 0x0000000000000246
       r12 = 0x00000001049a32a0
       r13 = 0x00007fff6f484800  libobjc.A.dylib`objc_msgSend
       r14 = 0x00000001049a3420
       r15 = 0x00007fff7a9c4615  
       rip = 0x000000010019add8  WorkerTest`Window1.Window1.openHugeViewBtn_Action%%o<Window1.Window1>o<PushButton> + 2712
    rflags = 0x0000000000010246
        cs = 0x000000000000002b
        fs = 0x0000000000000000
        gs = 0x0000000000000000

rdx is negative!?

Feedback case 62946

0x10019aea0 <+2912>: leaq   0x457e1(%rip), %rax       ; @"Hello2"
0x10019aea7 <+2919>: movq   -0x258(%rbp), %rcx
0x10019aeae <+2926>: movl   %ecx, %edx
0x10019aeb0 <+2928>: movl   %edx, -0x13c(%rbp)
0x10019aeb6 <+2934>: movq   -0xd8(%rbp), %rsi
0x10019aebd <+2941>: movslq %edx, %rdi
0x10019aec0 <+2944>: movsd  (%rsi,%rdi), %xmm0        ; xmm0 = mem[0],zero 
0x10019aec5 <+2949>: movsd  %xmm0, -0x138(%rbp)
0x10019aecd <+2957>: movsd  %xmm0, -0xe8(%rbp)
0x10019aed5 <+2965>: movq   %rax, %rdi

Why is there edx and ecx, which are 32-bit registers. It should be rdx and rcx for the 64-bit ones, right?

2 Likes

Confirmed: Ptr.anything crashes as soon as you exceed a 2GB index (macOS, xojo2020r2)

1 Like