[Bug c/29186] optimzation breaks floating point exception flag reading

kreckel at ginac dot de gcc-bugzilla@gcc.gnu.org
Tue Oct 31 11:49:00 GMT 2006



------- Comment #16 from kreckel at ginac dot de  2006-10-31 11:48 -------
A quote from <http://www.cs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF>:

"While on the subject of miscreant compilers, we should remark their
increasingly common tendency to reorder operations that can be executed
concurrently by pipelined computers. C programmers may declare a variable
volatile to inhibit certain reorderings. A programmer's intention is thwarted
when an alleged 'optimization' moves a floating-point instruction past a
procedure-call intended to deal with a flag in the floating-point status word
or to write into the control word to alter trapping or rounding. Bad moves like
these have been made even by compilers that come supplied with such procedures
in their libraries. (See _control87 , _clear87 and _status87 in compilers for
Intel processors.) Operations’ movements would be easier to debug if they
were highlighted by the compiler in its annotated re-listing of the
source-code. Meanwhile, so long as compilers mishandle attempts to cope with
floating-point exceptions, flags and modes in the ways intended by IEEE
Standard 754, frustrated programmers will abandon such attempts and compiler
writers will infer wrongly that unexercised capabilities are unexercised for
lack of demand."


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29186



More information about the Gcc-bugs mailing list