Bug 18784

Summary: Floating point calculation inconsistent within program with -O2
Product: gcc Reporter: Graham Murphy <Graham.Murphy>
Component: cAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: gcc-bugs
Priority: P2    
Version: 3.3.3   
Target Milestone: ---   
Host: i686-pc-linux Target: i686-pc-linux
Build: i686-pc-linux Known to work:
Known to fail: Last reconfirmed:
Attachments: .c, .i, .s, .o and x86 executeable.
gcc -v output

Description Graham Murphy 2004-12-02 14:18:58 UTC
Attached (hopefully) is a C program that performs a simple
floating point calculation that produces a number very close
to an integer. When this calculation is done twice within 
the same program, two different answers are produced if
there is an intervening print statement and -O2 or greater
optimization.

Problem appears with gcc 2.9 through 3.4.2 and Pentiums 1 - 4.
Not seen on AMD or Sparcs.

I have examined the FPU IEEE rounding control bits but see no
difference between the two sections.
Comment 1 Graham Murphy 2004-12-02 14:21:03 UTC
Created attachment 7656 [details]
.c, .i, .s, .o and x86 executeable.

Test suite.
Comment 2 Andrew Pinski 2004-12-02 14:21:57 UTC

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

*** This bug has been marked as a duplicate of 323 ***
Comment 3 Graham Murphy 2004-12-02 14:26:07 UTC
Created attachment 7658 [details]
gcc -v output

Output from the compile. Seems normal.