<div dir="ltr"><div><div><div><div><div>I have a somehow big pascal game (more than 200k lines of code) that I'm developing with FPC.<br></div>Right now I found a strange crashing bug that only happened in iOS, running in the device (in the iOS simulator does not crash). Desktop platforms don't have any problems running the same code (Windows, Linux etc). <br>
In Android I'm not sure, because while it does not crash in my devices, in many players devices the game just crashes in that exact spot.<br>
<br></div></div><div>So I have some questions.<br></div><div><br></div><div>1 - This bug only happens with -O2 on, but with optimizations off the game does not crash. I always thought that using optimizations was safe. Can there be a compiler bug in the ARM7 codegen? <br>
</div><div>Lately I've been shipping the game without optimizations, but of course, this means less performance.<br></div><div>I thought that the bug could be caused by differences in memory allocations on those different OSes, but I'm not sure.<br>
Anyone has a clue how to discover the difference between O2 and O- that could cause such problems?<br></div><br><div>2 - I cannot get line info to work on iOS, all exceptions reported show just addresses. I am using -gl so it should work, or it works only in some targets?<br>
</div><div>If not possible to get automatic line info, is there any way to transform those adresses into line numbers with some tool?<br></div><div>I think in Android the same thing happens, line info not generated when using -gl, but I'm not 100% sure (I can check later).<br>
</div></div><div><br></div>3 - Finally, since I'm still using FPC 2.6.2 I decided to upgrade to 2.7.1 and try to recompile the game, to see if the crash in the game was gone.<br></div><div><div>But, with FPC 2.7.2 I simply can't compile the game, it gives errors in the assembler stage.<br>
<br>Basically I get lots of errors similar to those<br>armv7/MinimonBattle.s:44518:co-processor offset out of range<br><br></div><div>I checked the asm of the lines in question, it is mostly just a bunch of labels, eg:<br>
Lj21874:<br> .byte 0,0,32,64<br>Lj21879:<br> .long L_U_$MINIMONDB_$$_MOVEINFO$non_lazy_ptr-La1335-8<br>Lj21884:<br></div><div> .byte 0,0,32,64<br><br></div><div>Compilation switches are the following:<br>
-Sgix -Cfvfpv2 -gw2 -gl -O2 -CRriot <br><br></div><div>The error happens with Cfvfpv3 instead, and with optimizations on or off.<br></div><div>I'm using latest XCode, by the way.<br><br></div><div>Anyone has a clue why this happens? Could it be a compiler or assembler bug?<br>
</div>I'm guessing it, but the problem might be because some of the game files are too big (10k lines of code or more), and as such too many labels are generated in just one file. Could this cause problems?<br></div>
<div>Even if was because of the file size, FPC 2.6.2 generated asm code that worked fine, so I dont understand.<br></div><div><div><div>If anyone wants to take a look at the generated asm, tell me and I'll send you the file.<br>
</div><br></div><div>Regards,<br>Sergio<br></div><div><br></div></div></div>