I've been working on a program for some time now without any massive problems, but now I'm facing an odd problem. The problem occured after I added a simple FOR ... TO ... DO statement to a procedure in one of my units. The program compiles and runs without any problems, but as soon as I exit the program, Borland Pascal closes and I get an "Illegal operation" Window in Win95. If I remove this simple FOR/TO/DO statement, no problem. I tried running the compiled exe in pure DOS - the same thing happens, except the program just freezes when I exit it. Actually, it doesn't even return to the MS-DOS prompt - the last screen displayed while running the program just remains frozen on screen.
I really can't figure out why this suddenly happens just because I add a simple FOR/TO/DO statement which only uses a single Byte variable. I've tried increasing the memory sizes, but that didn't change anything.
Does anybody have an idea what this problem could be caused by?