[fpc-pascal] Floating point exception not always caught on Linux i386.

Bernd Mueller mueller.b at gmx.net
Fri Oct 11 10:34:16 CEST 2019


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.


More information about the fpc-pascal mailing list