I am trying to make a small project using PascalScript included into the Lazarus distribution. I have an issue when I deliberately code a zero division into the script.
My expectations was that the TPSScript.Execute will return false and then ExecErrorCode will be ErDivideByZero, but unfortunately the whole program aborts and the control is not returned to my calling method.
The exception is thrown in TPSExec.DoCalc, upsRuntime.pas, line 5948.
I can see later in the TPSExec.DoCalc some exception handling code, line 6329:
except
{$IFDEF DELPHI6UP}
Tmp := AcquireExceptionObject;
{$ELSE}
if RaiseList <> nil then
begin
Tmp := Exception(PRaiseFrame(RaiseList)^.ExceptObject);
...
I have tried to enable all runtime checks in the project, but it doesn't helps.
The message is:
Project PAScr raised exception class 'External: SIGFPE'.
In file 'uPSRuntime.pas' at line 5948:
btS32: tbts32(var1^) := tbts32(var1^) div tbts32(var2^);The Pascal script is:
var
A, B, C: Integer;
begin
A := 1;
B := 2;
C := A + B;
C := B div 0;
end.
Does anybody have an idea what I'm missing?
Lazarus 1.9.0 r63034 FPC 3.1.1 i386-win32-win32/win64