|
@@ -717,7 +717,11 @@ End;
|
|
|
{$ifndef FPC_SYSTEM_HAS_STACKTOP}
|
|
|
function StackTop: pointer;
|
|
|
begin
|
|
|
- result:=StackBottom+StackLength;
|
|
|
+ { Avoid wrap to zero on 32-bit }
|
|
|
+ if ptruint(StackBottom)+ StackLength > high(ptruint) then
|
|
|
+ result:=pointer(ptruint(high(ptruint)))
|
|
|
+ else
|
|
|
+ result:=StackBottom + StackLength;
|
|
|
end;
|
|
|
{$endif FPC_SYSTEM_HAS_STACKTOP}
|
|
|
|