Bug 520275 - gcc produces numerically inaccurate code
Summary: gcc produces numerically inaccurate code
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 11
Hardware: i386
OS: Linux
low
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-08-30 02:03 UTC by Dmitri A. Sergatskov
Modified: 2009-08-31 21:39 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-08-31 17:11:44 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
paranoia log (3.39 KB, application/x-gzip)
2009-08-30 02:03 UTC, Dmitri A. Sergatskov
no flags Details

Description Dmitri A. Sergatskov 2009-08-30 02:03:01 UTC
Created attachment 359182 [details]
paranoia log

Description of problem:
gcc on i386 produces numerically inaccurate code as demonstrated 
program "paranoia" from netlib (http://www.netlib.org/paranoia/)

Version-Release number of selected component (if applicable):
gcc version 4.4.1 20090725 (Red Hat 4.4.1-2) (GCC) 

How reproducible:
100%

Steps to Reproduce:
1. get paranoia.c
2. compile: gcc -O2 -o paranoia paranoia.c -lm
3. Run resulting program (./paranoia)
  
Actual results:
The log is attached. The summary:

The number of  FAILUREs  encountered =       4.
The number of  SERIOUS DEFECTs  discovered = 4.
The number of  DEFECTs  discovered =         3.
The number of  FLAWs  discovered =           2.

If I compile without optimization, the number of problems become two


The number of  DEFECTs  discovered =         1.
The number of  FLAWs  discovered =           1.


Expected results:

No FAILUREs, SERIOUS DEFECTs, or FLAWs

Additional info:

The test passes with flying colors on x86_64 platform.

Comment 1 Jakub Jelinek 2009-08-31 17:11:44 UTC
That's a user error.  If you want numerically stable results on i?86, you need either -msse2 -mfpmath=sse, or at least -ffloat-store.  Otherwise some operations are computed in higher precision than their types.

Comment 2 Dmitri A. Sergatskov 2009-08-31 21:39:39 UTC
OK, it is fair. Both of these switches do reduce number of
problems, but not to 0 though.

Thanks!


Note You need to log in before you can comment on or make changes to this bug.