diff --git a/rtl/go32v2/system.pp b/rtl/go32v2/system.pp index 44c8bb2a81..bdf8c23334 100644 --- a/rtl/go32v2/system.pp +++ b/rtl/go32v2/system.pp @@ -642,8 +642,12 @@ end; var temp_int : tseginfo; Begin - StackLength := CheckInitialStkLen(InitialStkLen); +{ v2prt0.as adds 256 bytes to __stkbottom for extra safety during stack + checking, so we subtract 256 here in order to calculate StackTop correctly + and to ensure that StackLength = StackTop - StackBottom } + StackLength := CheckInitialStkLen(InitialStkLen)-256; StackBottom := __stkbottom; + StackTop := StackBottom + StackLength; { To be set if this is a GUI or console application } IsConsole := TRUE; { To be set if this is a library and not a program }