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 -- Summary: optimization problem with LAPACK routine cgtts2.f Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: billingd at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-cygwin GCC host triplet: i686-pc-cygwin GCC target triplet: i686-pc-cygwin http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19693