Bug 164154 - gcc floating point has problems when -O according to paranoia.c
Summary: gcc floating point has problems when -O according to paranoia.c
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc
Version: 3.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-07-25 13:45 UTC by gpk
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-07-25 21:34:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 323 0 None None None Never

Description gpk 2005-07-25 13:45:42 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616

Description of problem:
Running paranoia.c (a standard floating point test program),
compiled with optimization, reports many flaws and defects.



Version-Release number of selected component (if applicable):
gcc-3.2.3-52

How reproducible:
Always

Steps to Reproduce:
1. Download from http://www.netlib.org/paranoia/paranoia.c
2. gcc -O -o paranoia paranoia.c -lm
3. ./paranoia
  

Actual Results:  Much explanatory text, then:

Searching for Radix and Precision.
Radix = 2.000000 .
Closest relative separation found is U1 = 5.4210109e-20 .
 
Recalculating radix and precision
 gets better closest relative separation U1 = 9.2157185e-18 .
MYSTERY: recalculated Radix = 0.0000000e+00 .
FLAW:  Radix is not as good as 2 or 10.
FAILURE:  (1-U1)-1/2 < 1/2 is FALSE, prog. fails?.
The number of significant digits of the Radix is 0.000000 .
FAILURE:  Precision test appears to be inconsistent...
   PLEASE NOTIFY KARPINKSI!
        U1 = 9.2157185e-18, Z1 - U1 = -9.1615084e-18
        U2 = 1.0842022e-19, Z2 - U2 = 0.0000000e+00

 
 
Checking for guard digit in *, /, and -.
SERIOUS DEFECT:  Division lacks a Guard Digit, so X/1 != X.
FAILURE:  * and/or / gets too many last digits wrong.
SERIOUS DEFECT:  - lacks Guard Digit, so cancellation is obscured.
 



Expected Results:  Much explanatory text without the DEFECT warnings,
or the appeak to KARPINSKI.

Additional info:

Similar problems were seen on a Debian system, using gcc3.3,
so I'm pretty sure it's not a hardware problem.

Comment 1 Jakub Jelinek 2005-07-25 21:34:14 UTC
paranoia.c relies on no excess precision computation.  So, on IA-32 because
of its misdesigned FPU, you either need to use -ffloat-store (which is slow,
but more standard conforming (though still not fully, see GCC PR323), or, if you
have SSE2 support in hardware, -msse2 -mfpmath=sse.


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