[fpc-pascal]Double-precision recursion
Marco van de Voort
marcov at stack.nl
Thu Mar 29 23:19:01 CEST 2001
> > Looks like a FPU stack overflow...?
>
> You may be onto something here.
>
> I didn't know there a separate stack in the FPU. How can I learn more
> about how Free Pascal utilizes it?
Try to compile using -al, and check the generated assembler.
> > If you reduce the line "p := get+cof(n);" just to "p := cof(n);", then
> > the program works. (ehmm, it doesn't crash anymore...)
>
> Yes, but in the "real" program from which this trivial example was
> derived, this is not an option.
The problem is that if you kill this behaviour, you loose a lot of speed.
One could try to detect simple recursion in the compiler, but this would
only detect a -> a -> a recursion, and not a -> b -> a -> b -> a
> > But I'm somewhat surprised that BP sufferes from the same problem.
>
> Apparently both BP and FP use the FPU stack (if there is one) the same
> way. In this case, I'm surprised that the C version is not also subject
> to the same bug.
If BP behaves the same way, we are compatible, and then it is not a bug :-)
More information about the fpc-pascal
mailing list