<div dir="ltr"><div>What are the optimizations made between -O1 and -O2 on this target?<br><br>Are optimizations at this level materially different when comparing ARM to x86 output targets?<br><br>I ask because enabling -O2 breaks my code on ARM but runs fine all the way up to -O3 on x86.<br>
<br>It's no doubt something I'm doing wrong which -O2 is exposing so I thought I'd ask if anyone can suggest what types of error are likely with building with -O2. <br><br>Prima facie is looks like the object reference ("this" accessed via register r0) is corrupt when execution enters this TACTOR_UPDATE (via an Inherited call). The disassembly, cpu dump and "this reference" below show this but it's not clear to me why or how.<br>
<br></div>Any suggestions welcome!<br><div><br>Thanks, Bruce.<br><br>(gdb) disass<br>Dump of assembler code for function TACTOR__UPDATE:<br> 0x0006f450 <+0>: push {r4, r5, r6, r7, r8, r9, lr}<br> 0x0006f454 <+4>: sub sp, sp, #4<br>
0x0006f458 <+8>: mov r4, r0<br> 0x0006f45c <+12>: mov r5, r1<br> 0x0006f460 <+16>: mov r6, r2<br> 0x0006f464 <+20>: mov r0, #0<br> 0x0006f468 <+24>: bl 0x3b4a4 <fpc_stackcheck><br>
0x0006f46c <+28>: cmp r6, #7<br> 0x0006f470 <+32>: bne 0x6f504 <TACTOR__UPDATE+180><br> 0x0006f474 <+36>: ldr r0, [r4, #68] ; 0x44<br> 0x0006f478 <+40>: cmp r0, #0<br>
0x0006f47c <+44>: beq 0x6f4ec <TACTOR__UPDATE+156><br> 0x0006f480 <+48>: ldr r0, [r4, #100] ; 0x64<br> 0x0006f484 <+52>: cmp r0, r5<br> 0x0006f488 <+56>: bne 0x6f4ec <TACTOR__UPDATE+156><br>
0x0006f48c <+60>: ldrb r0, [r4, #86] ; 0x56<br> 0x0006f490 <+64>: cmp r0, #0<br> 0x0006f494 <+68>: beq 0x6f4ec <TACTOR__UPDATE+156><br> 0x0006f498 <+72>: mov r7, #0<br>
0x0006f49c <+76>: sub r7, r7, #1<br> 0x0006f4a0 <+80>: and r7, r7, #255 ; 0xff<br> 0x0006f4a4 <+84>: add r7, r7, #1<br> 0x0006f4a8 <+88>: and r7, r7, #255 ; 0xff<br>
0x0006f4ac <+92>: and r0, r7, #255 ; 0xff<br> 0x0006f4b0 <+96>: ldr r1, [r4, #68] ; 0x44<br> 0x0006f4b4 <+100>: mov r2, #1<br> 0x0006f4b8 <+104>: tst r1, r2, lsl r0<br>
0x0006f4bc <+108>: beq 0x6f4dc <TACTOR__UPDATE+140><br> 0x0006f4c0 <+112>: mov r2, r7<br> 0x0006f4c4 <+116>: mov r1, r4<br> 0x0006f4c8 <+120>: mov r0, r4<br> 0x0006f4cc <+124>: mov r3, r4<br>
0x0006f4d0 <+128>: ldr r3, [r3]<br> 0x0006f4d4 <+132>: ldr r3, [r3, #256] ; 0x100<br> 0x0006f4d8 <+136>: blx r3<br> 0x0006f4dc <+140>: cmp r7, #25<br> 0x0006f4e0 <+144>: bcc 0x6f4a4 <TACTOR__UPDATE+84><br>
0x0006f4e4 <+148>: mov r0, #0<br> 0x0006f4e8 <+152>: str r0, [r4, #68] ; 0x44<br> 0x0006f4ec <+156>: ldr r0, [r4, #104] ; 0x68<br> 0x0006f4f0 <+160>: cmp r0, r5<br>
0x0006f4f4 <+164>: bne 0x6f51c <TACTOR__UPDATE+204><br> 0x0006f4f8 <+168>: mov r0, #0<br> 0x0006f4fc <+172>: str r0, [r4, #60] ; 0x3c<br> 0x0006f500 <+176>: b 0x6f51c <TACTOR__UPDATE+204><br>
0x0006f504 <+180>: cmp r6, #2<br> 0x0006f508 <+184>: bne 0x6f51c <TACTOR__UPDATE+204><br> 0x0006f50c <+188>: mov r1, r5<br> 0x0006f510 <+192>: mov r0, r4<br> 0x0006f514 <+196>: mov r2, #0<br>
0x0006f518 <+200>: bl 0x6faac <TACTOR__SUBSCRIBE><br> 0x0006f51c <+204>: cmp r6, #6<br> 0x0006f520 <+208>: bne 0x6f570 <TACTOR__UPDATE+288><br> 0x0006f524 <+212>: mov r0, r4<br>
0x0006f528 <+216>: bl 0x6f764 <TACTOR__GETPARENT><br> 0x0006f52c <+220>: cmp r5, r0<br> 0x0006f530 <+224>: bne 0x6f570 <TACTOR__UPDATE+288><br>=> 0x0006f534 <+228>: ldrb r0, [r5, #86] ; 0x56<br>
0x0006f538 <+232>: cmp r0, #0<br> 0x0006f53c <+236>: beq 0x6f558 <TACTOR__UPDATE+264><br> 0x0006f540 <+240>: mov r0, r4<br> 0x0006f544 <+244>: mov r1, r4<br> 0x0006f548 <+248>: ldr r1, [r1]<br>
0x0006f54c <+252>: ldr r1, [r1, #240] ; 0xf0<br> 0x0006f550 <+256>: blx r1<br> 0x0006f554 <+260>: b 0x6f614 <TACTOR__UPDATE+452><br> 0x0006f558 <+264>: mov r0, r4<br>
0x0006f55c <+268>: mov r1, r4<br> 0x0006f560 <+272>: ldr r1, [r1]<br> 0x0006f564 <+276>: ldr r1, [r1, #244] ; 0xf4<br> 0x0006f568 <+280>: blx r1<br> 0x0006f56c <+284>: b 0x6f614 <TACTOR__UPDATE+452><br>
0x0006f570 <+288>: mov r0, r4<br> 0x0006f574 <+292>: bl 0x119614 <CLASSES$_$TCOMPONENT_$__$$_GETCOMPONENTCOUNT$$LONGINT><br> 0x0006f578 <+296>: cmp r0, #0<br> 0x0006f57c <+300>: ble 0x6f614 <TACTOR__UPDATE+452><br>
0x0006f580 <+304>: mov r0, r4<br> 0x0006f584 <+308>: bl 0x119614 <CLASSES$_$TCOMPONENT_$__$$_GETCOMPONENTCOUNT$$LONGINT><br> 0x0006f588 <+312>: subs r7, r0, #1<br> 0x0006f58c <+316>: bvc 0x6f594 <TACTOR__UPDATE+324><br>
0x0006f590 <+320>: bl 0x3b2c8 <fpc_overflow><br> 0x0006f594 <+324>: mov r8, #0<br> 0x0006f598 <+328>: cmp r7, r8<br> 0x0006f59c <+332>: blt 0x6f614 <TACTOR__UPDATE+452><br>
0x0006f5a0 <+336>: sub r8, r8, #1<br> 0x0006f5a4 <+340>: add r8, r8, #1<br> 0x0006f5a8 <+344>: mov r1, r8<br> 0x0006f5ac <+348>: mov r0, r4<br><br>(gdb) info reg<br>
r0 0xe 14<br>r1 0xb58af980 3045783936<br>r2 0x0 0<br>r3 0xb2a70 731760<br>r4 0xb5ad1e70 3048021616<br>r5 0xb58af980 3045783936<br>r6 0xb 11<br>
r7 0x4 4<br>r8 0x0 0<br>r9 0xb5ad1e70 3048021616<br>r10 0x4d0d84 5049732<br>r11 0xbeffeadc 3204442844<br>r12 0xbeffea70 3204442736<br>
sp 0xbeffea70 0xbeffea70<br>lr 0x6f578 456056<br>pc 0x6f580 0x6f580 <TACTOR__UPDATE+304><br>cpsr 0x20000010 536870928<br><br>(gdb) p this<br>$19 = (TACTOR) 0xe<br>
<br></div></div>