[fpc-pascal]Double-precision recursion

Jonas jonas at zeus.rug.ac.be
Fri Mar 30 10:19:56 CEST 2001


On Friday, March 30, 2001, at 12:52 AM, Rich Pasco wrote:

> >   var 
> >     d: Double; 
> >   begin 
> >     ... 
> >     d := c(...); 
> >     a := b + d; 
> >   end; 
>  
> Indeed, that is how I have repaired my real application program, and 
> it seems to work correctly.  While that makes me happy, for now, I 
> still think that FPC should be fixed to avoid the problem with the 
> original source code. 

W already have a bug report about this (<http://www.freepascal.org/bugs/showrec.php3?ID=1269>). We discussed it and while it will seriously slow down any FPU calculations involving function calls, the only solution is to save everything on the FPU stack to memory before calling any procedure. We will fix it this way, but until now no-one has gotten around doing it.

BP has the FPU stack overflow bug (it even contains a demo program to show it, indicating that back then they thought the programmer was responsible to work around this silly implementation of the 80x87 FPU), Delphi has it fixed (and uses the same technique as described above).


Jonas




More information about the fpc-pascal mailing list