Bug 41712 - ETIME not useable with -fdefault-real-8
Summary: ETIME not useable with -fdefault-real-8
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-15 07:20 UTC by Harald Anlauf
Modified: 2009-10-15 17:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Anlauf 2009-10-15 07:20:26 UTC
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
Comment 1 Dominique d'Humieres 2009-10-15 07:59:28 UTC
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)
Comment 2 Harald Anlauf 2009-10-15 08:47:12 UTC
(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()...
Comment 3 kargls 2009-10-15 14:13:30 UTC
(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.