Bug 891707

Summary: stdout redirect error
Product: [Fedora] Fedora Reporter: Michael Parkinson <Thumbtack2007>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 17CC: jakub, law
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-09 11:15:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
contains all routines, compile script, run script; also contains 32 bit executable none

Description Michael Parkinson 2013-01-03 18:43:12 UTC
Created attachment 672144 [details]
contains all routines, compile script, run script; also contains 32 bit executable

Description of problem: results of calculation displayed after redirect to a file are different than the results displayed when stdout goes directly to a terminal window


Version-Release number of selected component (if applicable): 
Fedora 3.6.10-2.fc17.i686, gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2) 


How reproducible: run enclosed script; should also happen if you run
enclosed 32 bit executable


Steps to Reproduce:
1. run script lusolve.bug.run in terminal window
2. look at results on the screen; they should be the same
3. notice that they are not
  
Actual results:
   1:1  7.0016212 +- 0.24727210E-02
   1:2  -0.22314226E-02 +- 0.27870338E-02
   1:4  -0.72836803E-04 +- 0.12898492E-03
   1:5  -0.99971462E-02 +- 0.58309151E-05
   1:6  1.0006572 +- 0.96526108E-03
    average error in rhs   0.52919594E-03
   1:1  7.0016298 +- 0.24756978E-02
   1:2  -0.22461086E-02 +- 0.27903942E-02
   1:4  -0.73604322E-04 +- 0.12914048E-03
   1:5  -0.99971117E-02 +- 0.58379455E-05
   1:6  1.0006628 +- 0.96642534E-03
    average error in rhs   0.52983098E-03


Expected results:
   1:1  7.0016212 +- 0.24727210E-02
   1:2  -0.22314226E-02 +- 0.27870338E-02
   1:4  -0.72836803E-04 +- 0.12898492E-03
   1:5  -0.99971462E-02 +- 0.58309151E-05
   1:6  1.0006572 +- 0.96526108E-03
    average error in rhs   0.52919594E-03
   1:1  7.0016212 +- 0.24727210E-02
   1:2  -0.22314226E-02 +- 0.27870338E-02
   1:4  -0.72836803E-04 +- 0.12898492E-03
   1:5  -0.99971462E-02 +- 0.58309151E-05
   1:6  1.0006572 +- 0.96526108E-03
    average error in rhs   0.52919594E-03


Additional info: does not occur in double precision version of routine 
                 does not occur on x86_64 machine running same version of Fedora and same version of gcc
                 may be a Linux redirect problem rather than a gcc problem (cannot tell; very peculiar bug)

Comment 1 Michael Parkinson 2013-01-03 18:50:12 UTC
Important note: also does not occur when the optimization level is -O2

Comment 2 Jakub Jelinek 2013-01-09 11:15:32 UTC
Please read http://gcc.gnu.org/PR323
If you can't tolerate excess precision effects, you either need to avoid i?86, or use -msse2 -mfpmath=sse and limit yourself to CPUs with SSE2 support, or use -ffloat-store.  If you can tolerate excess precision effects, but need what the C standards mandates for them, you can use -std=c99 or -fexcess-precision=standard