Hello.
I dont know if it could help but
Some applications compiled with optimization DFA may have problems on Windows.
DFA optimization was added in -O3 optimization type.
-O3 = O2 + CONSTPROP + DFA + USELOADMODIFYSTORE + LOOPUNROLL
If you use -O3 or -O4 it is safer to add also -OoNODFA to disable DFA.
From fpc wiki 3.0.0 about New Feature DFA optimization:
https://wiki.freepascal.org/FPC_New_Features_3.0.0Dead store elimination
Overview: The compiler can now, to a limited extent, remove stores to local variables and parameters if these values are not used before they are overwritten.
Notes: The use of this optimization requires that data flow analysis (-Oodfa) is enabled.
It can help in particular with cleaning up instructions that have become useless due to constant propagation.
More information: -Oodfa is still a work in progress.