Bug 19693 - optimization problem with LAPACK routine cgtts2.f
Summary: optimization problem with LAPACK routine cgtts2.f
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on: 18902
Blocks: 5900
  Show dependency treegraph
 
Reported: 2005-01-29 13:48 UTC by David Billinghurst
Modified: 2005-04-20 02:30 UTC (History)
2 users (show)

See Also:
Host: i686-pc-cygwin
Target: i686-pc-cygwin
Build: i686-pc-cygwin
Known to work:
Known to fail:
Last reconfirmed: 2005-01-30 13:57:14


Attachments
driv.f: test driver (210 bytes, text/plain)
2005-01-29 13:51 UTC, David Billinghurst
Details
cgtts2.f is LAPACK routine that is miscompiled (1.78 KB, text/plain)
2005-01-29 13:52 UTC, David Billinghurst
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Billinghurst 2005-01-29 13:48:40 UTC
With gfortran 20050129 I get a testsuite failure at -O2 that I don't see at -
O0.  The failure is in the CGT tests in ctest.in:

 CGT:  General tridiagonal
 Matrix types (1-6 have specified condition numbers):
    1. Diagonal                        7. Random, unspecified CNDNUM
    2. Random, CNDNUM = 2              8. First column zero
    3. Random, CNDNUM = sqrt(0.1/EPS)  9. Last column zero
    4. Random, CNDNUM = 0.1/EPS       10. Last n/2 columns zero
    5. Scaled near underflow          11. Scaled near underflow
    6. Scaled near overflow           12. Scaled near overflow
 Test ratios:
    1: norm( L * U - A )  / ( N * norm(A) * EPS )
    2: norm( B - A * X )  / ( norm(A) * norm(X) * EPS )
    3: norm( X - XACT )   / ( norm(XACT) * CNDNUM * EPS )
    4: norm( X - XACT )   / ( norm(XACT) * CNDNUM * EPS ), refined
    5: norm( X - XACT )   / ( norm(XACT) * (error bound) )
    6: (backward error)   / EPS
    7: RCOND * CNDNUM - 1.0
 Messages:
 NORM ='O', N =    1,           type  5, test( 7) =  0.16777E+08
 NORM ='I', N =    1,           type  5, test( 7) =  0.16777E+08
 TRANS='N', N =    1, NRHS=  1, type  5, test( 3) = 

I have reduced it to the miscompilation of routine cgtts2.f at -O2.  I have 
isolated a single failing case, but if I try to change the routine the problem 
evaporates.

Attached is:
 - driv.f: a small driver program
 - cgtts2.f: the LAPACK routine with the problem.

To reproduce:

gfortran -o pass.exe -O0 driv.f cgtts2.f
gfortran -o fail.exe -O0 driv.f cgtts2.f
./pass
 B(1,1) =  ( 4.0564819E+31,  0.000000    )

./fail
At line 15 of file driv.f
Internal Error: printf is broken
 B(1,1) =  (

Note:  The internal error is PR 19363
Comment 1 David Billinghurst 2005-01-29 13:51:00 UTC
Created attachment 8099 [details]
driv.f: test driver

driv.f is driver routine
Comment 2 David Billinghurst 2005-01-29 13:52:00 UTC
Created attachment 8100 [details]
cgtts2.f is LAPACK routine that is miscompiled

cgtts2.f is LAPACK routine that is miscompiled
Comment 3 Andrew Pinski 2005-01-29 13:55:06 UTC
At -O0 on powerpc-darwin I get:
 B(1,1) =  (     +Infinity,           NaN)

Comment 4 David Billinghurst 2005-01-30 12:15:20 UTC
This goes away when we set flag_complex_divide_method = 1 in toplev.c - 
overflow in complex division - which is consistent with the magnitude of the 
inputs.

PR 18902 again.
Comment 5 Tobias Schlüter 2005-03-01 20:22:13 UTC
Can this be closed with the recent change of default complex divide algorithm?
Comment 6 David Billinghurst 2005-03-02 00:07:45 UTC
Fixed by changes to complex divide algorithm.  
See comment #46 on PR5900 for LAPACK testsuite results at -O2.