[fpc-devel] FPC ARM7 problems

Sergio Flores relfos at gmail.com
Thu Aug 7 14:09:16 CEST 2014


I have a somehow big pascal game (more than 200k lines of code) that I'm
developing with FPC.
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).
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.

So I have some questions.

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?
Lately I've been shipping the game without optimizations, but of course,
this means less performance.
I thought that the bug could be caused by differences in memory allocations
on those different OSes, but I'm not sure.
Anyone has a clue how to discover the difference between O2 and O- that
could cause such problems?

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?
If not possible to get automatic line info, is there any way to transform
those adresses into line numbers with some tool?
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).

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.
But, with FPC 2.7.2 I simply can't compile the game, it gives errors in the
assembler stage.

Basically I get lots of errors similar to those
armv7/MinimonBattle.s:44518:co-processor offset out of range

I checked the asm of the lines in question, it is mostly just a bunch of
labels, eg:
Lj21874:
    .byte    0,0,32,64
Lj21879:
    .long    L_U_$MINIMONDB_$$_MOVEINFO$non_lazy_ptr-La1335-8
Lj21884:
    .byte    0,0,32,64

Compilation switches are the following:
-Sgix -Cfvfpv2 -gw2 -gl -O2 -CRriot

The error happens with Cfvfpv3 instead, and with optimizations on or off.
I'm using latest XCode, by the way.

Anyone has a clue why this happens? Could it be a compiler or assembler bug?
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?
Even if was because of the file size, FPC 2.6.2 generated asm code that
worked fine, so I dont understand.
If anyone wants to take a look at the generated asm, tell me and I'll send
you the file.

Regards,
Sergio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140807/2fc17792/attachment.html>


More information about the fpc-devel mailing list