Bug 6824 - Wrong optimized fp code
Summary: Wrong optimized fp code
Status: RESOLVED DUPLICATE of bug 323
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.1
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
: 11040 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-05-26 12:46 UTC by have
Modified: 2003-07-10 11:35 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
fp_bug.bz2 (83.32 KB, application/octet-stream)
2003-05-21 15:17 UTC, have
Details

Note You need to log in before you can comment on or make changes to this bug.
Description have 2002-05-26 12:46:00 UTC
Wrong optimiszed floatting point code : a same code 
in a function or in a struct (member of static function)
produces a different result when -O? flag is enabled.
-ffloat-store flag produces a better (but longer) code.
(and sometimes with -finline-functions (following the context))
(more strange cases are: using std::cout or printf may change 
the final result !)

Without -O? flag, the code is always right.

Release:
g++ version 2.95.4(20011002), 3.0.4, 3.1

Environment:
Linux Intel i686 (Pentium III)

How-To-Repeat:
Runs the same code with or without optimization flags (-O, -O2, -O3),
the code may give bad result (the good one is 0)
Longer details (flags ...) are available for 2 test cases.
Comment 1 have 2002-05-26 12:46:00 UTC
Fix:
No idea.
Comment 2 Richard Henderson 2002-10-02 10:41:45 UTC
State-Changed-From-To: open->closed
State-Changed-Why: This is called computation with excess precision.
    
    See "What Every Computer Scientist Should Know about 
    Floating-Point Arithmetic" off of
    http://gcc.gnu.org/readings.html
Comment 3 Andrew Pinski 2003-05-30 21:58:53 UTC
*** Bug 11040 has been marked as a duplicate of this bug. ***
Comment 4 Andrew Pinski 2003-05-30 21:59:32 UTC
Reopening bug to ....
Comment 5 Andrew Pinski 2003-05-30 22:00:06 UTC
makr as invalid.
Comment 6 Andrew Pinski 2003-05-30 23:54:07 UTC
*** Bug 11040 has been marked as a duplicate of this bug. ***
Comment 7 Andrew Pinski 2003-07-10 11:31:49 UTC
Reopen bug to mark a dup of ...
Comment 8 Andrew Pinski 2003-07-10 11:32:42 UTC
bug 323 which is the master bug for excess precision.
Comment 9 Andrew Pinski 2003-07-10 11:35:12 UTC
Forgot to mark it as a dup of bug 323.

*** This bug has been marked as a duplicate of 323 ***