Genmath.inc is an includefile from the system unit that houses most floating point functions

This sounds like you have floating point assembler somewhere that doesn't emit a fwait. A lot of handcoded graphic libraries do this to speed up, but the problem is that a x87 (floating point) exception will only be caught at the "next" floating point assembler instruction.

So probably, there is some floating point CPU exception somewhere that is cannot be properly handled by the RTL because it doesn't have a fwait. Then the next time that trunc() is called, the exception is generated.

IOW the problem is most likely not in genmath.inc, but in some floating point code outside of it. This can be your code, but also e.g. a library like SDL. The easiest you can do is make a little procedure or so that calls trunc() on some constant and doesn't do much without it, and insert it here and there after library calls. The traceback might then help you find the problem