mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 20:49:23 +02:00
+ catch RTE 201
This commit is contained in:
parent
6fee6ddf3c
commit
d24fa6492c
@ -28,6 +28,20 @@ var
|
||||
a,b,c : longint;
|
||||
d,e,f : cardinal;
|
||||
res,res2 : int64;
|
||||
RTE201Buf : Jmp_Buf;
|
||||
OldExit : pointer;
|
||||
|
||||
procedure RTE201Exit;
|
||||
begin
|
||||
ExitProc:=OldExit;
|
||||
if ExitCode=201 then
|
||||
begin
|
||||
ErrorAddr:=0;
|
||||
longjmp(RTE201Buf,1);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
a:=2;
|
||||
b:=-2;
|
||||
@ -35,9 +49,13 @@ begin
|
||||
d:=1;
|
||||
e:=$ffffffff;
|
||||
f:=$fffffffe;
|
||||
oldexit:=exitproc;
|
||||
exitproc:=@RTE201Exit;
|
||||
|
||||
{$R+}
|
||||
|
||||
if setjmp(RTE201Buf)=0 then
|
||||
begin
|
||||
res:=a+d;
|
||||
if res<>3 then
|
||||
fail(a,d,3,res,true);
|
||||
@ -133,6 +151,7 @@ begin
|
||||
res2:=res2+c;
|
||||
if (res+5<>f) or ((res and $ffff) <>$fff9) or (res<>res2) then
|
||||
fail(f,c,res2,res,true);
|
||||
end;
|
||||
|
||||
{$R-}
|
||||
|
||||
@ -232,8 +251,13 @@ begin
|
||||
if (res+5<>f) or ((res and $ffff) <>$fff9) or (res<>res2) then
|
||||
fail(f,c,res2,res,false);
|
||||
|
||||
exitproc:=@RTE201Exit;
|
||||
if setjmp(RTE201Buf)=0 then
|
||||
begin
|
||||
if {$R-} a+e <> {$R+} a+e then
|
||||
has_severe_errors:=true;
|
||||
end;
|
||||
|
||||
if has_severe_errors then
|
||||
halt(1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user