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.
Fix: No idea.
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
*** Bug 11040 has been marked as a duplicate of this bug. ***
Reopening bug to ....
makr as invalid.
Reopen bug to mark a dup of ...
bug 323 which is the master bug for excess precision.
Forgot to mark it as a dup of bug 323. *** This bug has been marked as a duplicate of 323 ***