Recent

Author Topic: [SOLVED] PascalScript SIGFPE  (Read 1046 times)

y.ivanov

  • Full Member
  • ***
  • Posts: 197
[SOLVED] PascalScript SIGFPE
« on: May 09, 2021, 06:22:56 pm »
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:

Code: Pascal  [Select][+][-]
  1.   except
  2.     {$IFDEF DELPHI6UP}
  3.     Tmp := AcquireExceptionObject;
  4.     {$ELSE}
  5.     if RaiseList <> nil then
  6.     begin
  7.       Tmp := Exception(PRaiseFrame(RaiseList)^.ExceptObject);
  8.   ...
  9.  

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:
Code: Pascal  [Select][+][-]
  1. var
  2.   A, B, C: Integer;
  3. begin
  4.   A := 1;
  5.   B := 2;
  6.   C := A + B;
  7.   C := B div 0;
  8. end.
  9.  

Does anybody have an idea what I'm missing?

Lazarus 1.9.0 r63034 FPC 3.1.1 i386-win32-win32/win64
« Last Edit: May 10, 2021, 10:43:35 am by y.ivanov »

y.ivanov

  • Full Member
  • ***
  • Posts: 197
Re: PascalScript SIGFPE
« Reply #1 on: May 09, 2021, 10:19:22 pm »
Update: Everything runs as expected when started without debugger. It is not related to PascalScript. It seems to be related to the GDB.

Tested with the test example from https://forum.lazarus.freepascal.org/index.php/topic,22877.msg135755.html#msg135755
Also aborts immediately on SGFPE when debugged (doesn't write the class name) and works fine when started in console.

Most probably the GDB.exe must be updated...

 

TinyPortal © 2005-2018