[fpc-pascal] unexpected termination with no errors

James Richters james at productionautomation.net
Wed May 15 14:07:09 CEST 2019

A program I have been working on for years has suddenly developed a bug in it and at a certain point, it is just terminating and not giving me any runtime errors or any error of any kind.   It's just running.... running... running... then BAM - GONE, no explanation....    %errorlevel% is -1073741819   

I have been trying to track it down by putting writeln's in my code before and after the section that is causing me the problem, but without the diagnostic information I normally get, this is very tedious.    I am at a point now where I've determined that it's something in a data processing loop that has hundreds of case statements... If I try to writeln all so I can see what's the last thing it wrote to the console before it crashed, it takes so long to run it's going to take me a very long time.   If I had the runtime error or some kind of information, I would have fixed this in minutes, but doing it this way has already taken me hours.

I wrote a sample program that generates a runtime error on purpose and it's working fine... I get the normal runtime error output I always do telling me what the problem is and what line number it's on.. etc... 

The strange thing about this bug is that I can run the program on the same computer successfully in my development directory but it crashes when it's in another installation I have for pre-release testing... so it's not crashing when I run it from the FPC text IDE.. but when I move the executable over to my pre-release testing directory, then it is crashing like this with no indication of anything except the strange errorlevel being set. 

Has anyone encountered anything like this before or know how I can make sure I always get the maximum amount of debugging info when my program crashes?    

More information about the fpc-pascal mailing list