[Lazarus] Cross-compile for Linux strange behaviour with floating point constants
Sven Barth
pascaldragon at googlemail.com
Sun Nov 24 01:17:58 CET 2019
Am 20.11.2019 um 19:19 schrieb R Smith via lazarus:
> Is there something I can check on my side? Does this work for others?
> Might this be a cross-compile bug of sorts? Is this some FPC, FPU or
> Linux peculiarity I'm not aware of?
Win64 is essentially the only x86 platform that does *not* support and
use the Extended type. Thus a cross compiler from x86_64-win64 to any
other i8086, i386 or x86_64 target will result in strange or undefined
behavior due to it not providing the Extended constants correctly. To
solve this you need to compile your code on a Linux system (you can use
WSL without any problems) or make sure that you only use Double (you
also need to cast floating point constants to Double in that case as
otherwise FPC tries to use Extended nevertheless, which is why the
variable in your example works, but the constant does not).
There is the plan to add software floating point support for Extended to
the compiler for platforms like Win64, but it's not a trivial endeavour.
Please note that cross compiling from any other platform that does not
support Extended to x86 will have the same problem (except when cross
compiling to Win64).
Regards,
Sven
More information about the lazarus
mailing list