Maurice Lombardi wrote:
This is a problem of stack overflow, presumably due to this complexity. The default stack in DJGPP is 512k Increasing it to 2048k makes the problem disappear.
I increase the stack manually in DJGPP by typing
stubedit gpc1.exe minstack=2048K
I have checked that you can do it automatically by including the following lines in peter8.pas immediately after the program header
{$ifdef __GO32__} const MinStackSize: Cardinal = $200000; attribute (name = '_stklen'); {$endif}
(the recipe is somewhere in the gpc docs)
One can easily reduce the memory usage of `peter8.pas'. For example intead of 1000 char size for arrays one could use 250 bytes. Also putting groups of tests in subroutines and calling subroutines should reduce stack usage. But in principle `peter8.pas' should run using just tens of kilobytes of stack space, so the failure can be classified as a bug (but probably an old one). Namely, the calls are independent and the compiler should re-use the stack space used in one call to perfrom another one. But ATM it allows that garbage accumulates and eats large part of the stack and the space can be re-used only when a routine returns. I am not sure how hard will be to fix this. And some programs may depend on this bug.