[fpc-devel] FPC 2.0.0 vs FPC 2.0.2 (div by zero)
Peter Vreman
peter at freepascal.org
Tue Mar 7 08:45:27 CET 2006
> Hi,
>
> I have a strange problem. My Qt4 demo program worked
> fine with FPC 2.0.0, but crashes (div by zero) with FPC 2.0.2.
> Debugging shows that indeed a div by zero is done within
> the Qt4 lib. However with FPC 2.0.0 or using C++ code the library
> isn't bothered with the div by zero. When I use FPC 2.0.2 however
> it is.
>
> I added some writelns euh printfs in the Qt lib:
> if (p1.x() == p2.x()) printf("Before DIV by Zero: p1.x:%f p2.x:
> %f\n",p1.x(),p2.x());
> edge.m = (p1.y() - p2.y()) / (p1.x() - p2.x()); // this causes the div by
> zero
> if (p1.x() == p2.x()) printf("After DIV by Zero: p1.x:%f p2.x:
> %f\n",p1.x(),p2.x());
>
> with FPC 2.0.2 I get
>
> Before DIV by Zero: p1.x:196.500000 p2.x:196.500000
> An unhandled exception occurred at $405CB772 :
> EDivByZero : Division by zero
> $405CB772
> etc
>
> with FPC 2.0.0 or the original C++ demo program I get:
> Before DIV by Zero: p1.x:196.500000 p2.x:196.500000
> After DIV by Zero: p1.x:196.500000 p2.x:196.500000
> Before DIV by Zero: p1.x:187.500000 p2.x:187.500000
> After DIV by Zero: p1.x:187.500000 p2.x:187.500000
> Before DIV by Zero: p1.x:100.000000 p2.x:100.000000
> After DIV by Zero: p1.x:100.000000 p2.x:100.000000
> and so on, never a crash (but why :-)
>
> Anyone any idea?
In 2.0.0 the fpu exceptions are disabled if linking to C. In 2.0.2 this is
fixed.
More information about the fpc-devel
mailing list