Hi, all gfortran versions from 4.1.x thru 4.5 refuse to compile the following program with -fdefault-real-8: program gfcbug90 real :: t(2) print *, etime (t) end program gfcbug90 % gfc4x gfcbug90.f90 -fdefault-real-8 gfcbug90.f90:3.18: print *, etime (t) 1 Error: 'x' argument of 'etime' intrinsic at (1) must be of kind 4 No problem with e.g. ifort or sunf95. Cheers, -ha
The manual reads: VALUES The type shall be REAL, DIMENSION(2). where I understand REAL as REAL(4). Hence if you want to use -fdefault-real-8, you have to avoid the "promotion" of the ETIME argument by using real(4) :: t(2)
(In reply to comment #1) > The manual reads: > > VALUES The type shall be REAL, DIMENSION(2). > > where I understand REAL as REAL(4). Hence if you want to use -fdefault-real-8, > you have to avoid the "promotion" of the ETIME argument by using > > real(4) :: t(2) Actually, the current manual does explicitly state REAL(4) e.g. for the extension SECNDS(), but not (yet) for ETIME(). So either the gfortran documentation needs to be fixed or my legacy code using ETIME()...
(In reply to comment #2) > (In reply to comment #1) > > The manual reads: > > > > VALUES The type shall be REAL, DIMENSION(2). > > > > where I understand REAL as REAL(4). Hence if you want to use -fdefault-real-8, > > you have to avoid the "promotion" of the ETIME argument by using > > > > real(4) :: t(2) > > Actually, the current manual does explicitly state REAL(4) > e.g. for the extension SECNDS(), but not (yet) for ETIME(). > > So either the gfortran documentation needs to be fixed > or my legacy code using ETIME()... The manual is fine the way it is currently written, but I'll update it to be more specific that REAL means REAL(4). OTOH, I would suggest that you update all your codes to use the standard conforming CPU_TIME function.
See http://gcc.gnu.org/ml/gcc-patches/2009-10/msg00993.html