Bug 18784 - Floating point calculation inconsistent within program with -O2
Summary: Floating point calculation inconsistent within program with -O2
Status: RESOLVED DUPLICATE of bug 323
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.3.3
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-02 14:18 UTC by Graham Murphy
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
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. (3.34 KB, application/octet-stream)
2004-12-02 14:21 UTC, Graham Murphy
Details
gcc -v output (584 bytes, text/plain)
2004-12-02 14:26 UTC, Graham Murphy
Details

Note You need to log in before you can comment on or make changes to this bug.
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.