If it is a difference between fpc versions, then start by checking how your code works in both versions when compiled with -O- (with no optimizations)
Some bugs in user code only manifest when compiled with optimizations.
If it is an uninitialized value, then compile with -gtttt ( 1 to 4 "t", each t makes a difference)
Other useful settings
-gh and Environment HEAPTRC="keepreleased"
may need lots of memory....
or if you are on linux: valgrind