Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-10

Floating point exception not always caught on Linux i386.

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd Mueller

Hello,

FPC 3.0.4, Linux i386

the following program should catch the floating point exception (always), but crashes on the fourth call to the procedure Run:

program test;
{$mode objfpc}{$H+}
procedure Run;
var
    r: Real;
    i: Integer;
begin
    i:= 1;
    try
       r:= i / 0.0;
    except
       r:= 0; // Crash  here on fourth call.
    end;
    Writeln('ok');
end;
begin
    Run;
    Run;
    Run;
    Run;
end.

The output:
ok
ok
ok
Runtime error 207 at $080480F9
$080480F9
$0804815C
$0806644D

The program was compiled with no additional compiler parameters. I could not reproduce this problem with the trunk version of the compiler, but all versions down to 2.2.2 show the described behavior. FPC 2.2.0 is working correct. The 64-bit version of FPC 3.0.4 works correct too.

Is this something for the bug tracker?

Regards, Bernd.

Reply by email

Zamrony P. Juhara
to Bernd Mueller: FPC 3.0.4, Linux i386 the following program should catch the floating point exception…

I use FPC 3.0.4 on Ubuntu 16.04
I get same behavior after compile it with ppc386. 64bit binary executable run OK

Zamrony P. Juhara
Fano Framework, Free Pascal web application framework https://fanoframework.github.io On Friday, October 11, 2019, 4:39:38 PM GMT+8, Bernd Mueller wrote:

Hello,

FPC 3.0.4, Linux i386

the following program should catch the floating point exception (always), but crashes on the fourth call to the procedure Run:

program test;
{$mode objfpc}{$H+}
procedure Run;
var
    r: Real;
    i: Integer;
begin
    i:= 1;
    try
      r:= i / 0.0;
    except
      r:= 0; // Crash  here on fourth call.
    end;
    Writeln('ok');
end;
begin
    Run;
    Run;
    Run;
    Run;
end.

The output:
ok
ok
ok
Runtime error 207 at $080480F9
  $080480F9
  $0804815C
  $0806644D

The program was compiled with no additional compiler parameters. I could not reproduce this problem with the trunk version of the compiler, but all versions down to 2.2.2 show the described behavior. FPC 2.2.0 is working correct. The 64-bit version of FPC 3.0.4 works correct too.

Is this something for the bug tracker?

Regards, Bernd.

Reply by email