Summary: | GNAT floating point optimization bug | ||
---|---|---|---|
Product: | gcc | Reporter: | 166255 |
Component: | target | Assignee: | Richard Kenner <kenner> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | bosch, ebotcazou, gcc-bugs |
Priority: | P3 | Keywords: | wrong-code |
Version: | 3.2.1 | ||
Target Milestone: | --- | ||
Host: | i386-linux | Target: | i386-linux |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
166255
2002-11-16 02:56:02 UTC
Responsible-Changed-From-To: unassigned->kenner Responsible-Changed-Why: Ada specialist. Richard, this bug is related to the very classical problem of the extra-precision of the x86 FPU. The "fix" for other languages is to pass "-ffloat-store" to the compiler. Is it valid for GNAT too? From: Geert Bosch <bosch@gnat.com> To: gcc-prs@gcc.gnu.org, 166255@bugs.debian.org, kalmquist1@hotmail.com, kenner@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org Cc: Subject: Re: ada/8606: GNAT floating point optimization bug Date: Tue, 13 May 2003 13:46:51 -0400 Indeed the issue here is the standard one of double rounding for 64-bit floating point types. There is nothing Ada-specific about this and these problems are identical in C. The -ffloat-store option may improve repeatability, but has two undesired effects: it degrades performance and it always causes double rounding, which can degrade accuracy. For numerical code that requires exact rounding, only use 32-bit or 80-bit floating point types. When you need an expression to be computed to exactly 32 bits without any excess precision, store it to a volatile variable. If you really need 64-bit types with exact rounding, you'll have to set the rounding mode accordingly, but this will need changes in the Ada run time to prevent it from using 80-bit types. -Geert The analysis in http://gcc.gnu.org/ml/gcc-bugs/2003-05/msg03134.html indicates that this bug is not Ada-specific (I'm not sure if it's x86-specific, technically speaking, though). As described earlier, varying accuracy on x86 depending on optimization is not a bug. A lot has been written about this over the years. Search the archives if you're interested. There is nothing to fix here. Reopening bug so it can be marked as a dup of ... bug 323, which is the master bug for excessive precision. *** This bug has been marked as a duplicate of 323 *** *** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/adult-chat-rooms Marked for reference. Resolved as fixed @bugzilla. |