[MLton] rounding modes and minimum gcc version

Matthew Fluet fluet at tti-c.org
Sat Apr 18 20:15:34 PDT 2009


On Sat, 18 Apr 2009, Adam Goode wrote:
> Looking into IEEE rounding mode stuff more, it looks like for gcc, if
> the rounding mode is going to be changed, then -frounding-math must be
> set, or else behavior is undefined. Otherwise, gcc could perform
> constant folding assuming the default rounding mode. I believe all of
> the runtime and anything compiled with the C backend must have this flag
> (but only if the rounding mode is actually ever changed from SML, is it
> easy to tell?).

I don't think this is necessary; do you have an example program that 
exhibits a bug?

See the thread starting at:
   http://mlton.org/pipermail/mlton-user/2007-July/001154.html
and the commits:
   http://mlton.org/cgi-bin/viewsvn.cgi?rev=5793&view=rev
   http://mlton.org/cgi-bin/viewsvn.cgi?rev=5794&view=rev
   http://mlton.org/cgi-bin/viewsvn.cgi?view=rev&rev=5799
and also the thread starting at:
   http://mlton.org/pipermail/mlton/2008-May/030262.html
and the commit:
   http://mlton.org/cgi-bin/viewsvn.cgi?view=rev&rev=6847

In short, the current SVN sources are very careful to keep gcc from seeing 
any opportunities for constant-folding of floating-point operations and to 
only constant-fold floating-point operations that are valid in all 
rounding modes.

-Matthew



More information about the MLton mailing list