------- Comment #12 from dominiq at lps dot ens dot fr 2007-06-20 15:43 ------- With the following changes to the original code:
[karma] f90/bug% diff -u pr32393.f pr32393_mod.f --- pr32393.f Mon Jun 18 16:46:48 2007 +++ pr32393_mod.f Wed Jun 20 17:40:03 2007 @@ -16,7 +16,7 @@ c+---------------------------------------------------------------------+ character its1*4 character title*72 - integer t +! integer t real cc, ctrans, dprod2, sdb, sdm, $ stdb, stdm, sum, ttt, uf, $ vf, wsf @@ -99,6 +99,7 @@ c| skip second variation if cc matrix = 0 | c+---------------------------------------------------------------------+ call scprod (ns*ns,1,1,cc,cc,sum) + sum = 0 if (sum.le.0.)go to 180 c+---------------------------------------------------------------------+ c| choose appropriate computational routine | @@ -182,8 +183,10 @@ not=6 nvg=3 iprec = 1 - call vr2 ( intp, ivg, ccrans, cc, ns, stdb, stdm, t, - $ k2, nlin, istab ) +! call vr2 ( intp, ivg, ccrans, cc, ns, stdb, stdm, t, +! $ k2, nlin, istab ) + call vr2 ( 0, ivg, ccrans, cc, ns, stdb, stdm, t, + $ 0, 0, 0 ) stop end subroutine clect2 I get with gfortran: [karma] f90/bug% gfc -g -O3 pr32393_mod.f [karma] f90/bug% a.out 1 lower triangular matrix with 3 rows row 1 0.8000E+01 row 2 0.9000E+01 0.1000E+02 row 3 0.1100E+02 0.1200E+02 0.1300E+02 iprec = 1 1 lower triangular matrix with 3 rows row 1 0.1600E+02 row 2 0.9000E+01 0.2000E+02 row 3 0.1100E+02 0.1200E+02 0.2600E+02 [karma] f90/bug% gfc -g -O1 pr32393_mod.f [karma] f90/bug% a.out 1 lower triangular matrix with 3 rows row 1 0.8000E+01 row 2 0.9000E+01 0.1000E+02 row 3 0.1100E+02 0.1200E+02 0.1300E+02 iprec = 1 1 lower triangular matrix with 3 rows row 1 0.1600E+02 row 2 0.9000E+01 0.2000E+02 row 3 0.1100E+02 0.1200E+02 0.2600E+02 [karma] f90/bug% gfc -g -O1 -ffast-math -funroll-loops pr32393_mod.f [karma] f90/bug% a.out 1 lower triangular matrix with 3 rows row 1 0.8000E+01 row 2 0.9000E+01 0.1000E+02 row 3 0.1100E+02 0.1200E+02 0.1300E+02 iprec = 1 1 lower triangular matrix with 3 rows row 1 0.1600E+02 row 2 0.9000E+01 0.2000E+02 row 3 0.1100E+02 0.1200E+02 0.2600E+02 [karma] f90/bug% gfc -g pr32393_mod.f [karma] f90/bug% a.out 1 lower triangular matrix with 3 rows row 1 0.8000E+01 row 2 0.9000E+01 0.1000E+02 row 3 0.1100E+02 0.1200E+02 0.1300E+02 iprec = 1 1 lower triangular matrix with 3 rows row 1 0.1600E+02 row 2 0.9000E+01 0.2000E+02 row 3 0.1100E+02 0.1200E+02 0.2600E+02 Note that I have only given some values to variables used in tests (plus set t to real). BTW I do not see (beside obfuscation) the interest of the constructs: jt=t(j2) tt=.5*tt t(j2)=jt where jt and tt are equivalenced! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32393