This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/323] optimized code gives strange floating point results
- From: "cognot at earthdecision dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 May 2005 10:03:36 -0000
- Subject: [Bug rtl-optimization/323] optimized code gives strange floating point results
- References: <20000614141601.323.mirtich@merl.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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