It may have been the case that I had an outdated .gpi file. After removing it, and compiling again the internal compiler error disappeared.
I am still confused that the compiler refers to Testgamestatistics as a function, because it actually is a procedure. On the line where it complains, there is a call of a procedure in the unit whose .gpi file may have been outdated.
Thanks,
Tom