http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29383
--- Comment #11 from Sean Santos <quantheory at gmail dot com> 2013-04-14 20:08:59 UTC --- I'm doing a bit of research because I'm considering trying to tackle part of this soon. I believe that the Fortran standard does not require the rounding mode to apply to operations performed during constant folding, so point 4 above is moot. Please see the collected interpretations of F2003: http://j3-fortran.org/doc/standing/links/016.txt Particularly see F03/0040 and F03/0078. In combination they guarantee that the compiler is allowed to transform expressions at compile time according to the "mathematical equivalence" rule regardless of the rounding mode. In any case, the rounding mode cannot always be established at compile time; if the committee had not decided upon this behavior, then constant folding would often be impossible, period. The Fortran 2003 and 2008 standards also give examples where constant folding and propagation are allowed to influence whether or not an IEEE exception is signaled.
