[MLton] Re: Bug? print statement makes program terminate / run-forever

Vesa Karvonen vesa.a.j.k at gmail.com
Wed Jun 24 12:06:40 PDT 2009


On Wed, Jun 24, 2009 at 8:11 PM, Wesley W. Terpstra<wesley at terpstra.ca> wrote:
> On Wed, Jun 24, 2009 at 7:03 PM, Wesley W. Terpstra <wesley at terpstra.ca>
> wrote:
>>
>> Depending on if the 'print' statement is present, the program either
>> loops forever or terminates rapidly.
>
> MLton 20061107 works. So does 20070826.
>
> I suspect these recent floating point optimizations are to blame?

Doesn't look like it as the the problem doesn't seem to reproduce on
amd64 (and there doesn't seem to be much scope for constant folding).
(I'll try shortly with x86.)  Did you try this on a x86 platform?  If
so, did you try with -ieee-fp true?  Here is my theory.  On x86, the
print in the loop has the effect of forcing the y' value out of FP
registers.  This allows the loop to terminate.  Otherwise, with the
80-bit registers of the x86, and the 80-bit value of y' in a register
at the time of the comparison, the loop will never terminate as the
64-bit value of y and the 80-bit value of y' will never be equal.

-Vesa Karvonen



More information about the MLton mailing list