[Bug rtl-optimization/323] optimized code gives strange floating point results

cognot at earthdecision dot com gcc-bugzilla@gcc.gnu.org
Fri May 20 10:04:00 GMT 2005


------- Additional Comments From cognot at earthdecision dot com  2005-05-20 10:03 -------
(In reply to comment #59)
> 
> I had this bug on x86 architecture, with no optimization of the code (no -OX)
> and with float-store on. My workaround was to store the return of the double
> function in a auxliar double variable before comparison.
> Have you an other suggestion ?
> 

The way I've "fixed" (more like avoided) this problem is to have:

#include <fpu_control.h>

void set_math_double_precision() {
  fpu_control_t fpu_control = 0x027f ;
  _FPU_SETCW(fpu_control);
}

and make sure this function is called before doing any FP operations. It only
needs to be called once.

Richard.

-- 


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



More information about the Gcc-bugs mailing list