This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/52333] New: Explicit etime interface should work
- From: "pablomme at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 22 Feb 2012 02:48:18 +0000
- Subject: [Bug fortran/52333] New: Explicit etime interface should work
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52333
Bug #: 52333
Summary: Explicit etime interface should work
Classification: Unclassified
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: pablomme@googlemail.com
gfortran differs from all other compilers I have access to (Intel's, NAG's,
PathScale's, Portland Group's, Sun's and g95) in that it does not accept
defining an explicit interface to the etime intrinsic:
--
$ cat test_etime.f90
PROGRAM test_etime
IMPLICIT NONE
REAL x(2)
print *,etime(x)
END PROGRAM test_etime
$ cat test_etime_iface.f90
PROGRAM test_etime_iface
IMPLICIT NONE
REAL x(2)
INTERFACE
REAL FUNCTION etime(x)
REAL,INTENT(inout) :: x(2)
END FUNCTION etime
END INTERFACE
print *,etime(x)
END PROGRAM test_etime_iface
$ echo "NY" ;\
> for c in gfortran ifort nagfor pathf95 pgf95 g95 sunf95 ; do\
> $c -o t test_etime.f90 >& /dev/null && a=1 || a=0 ;\
> rm -f t *.o ;\
> $c -o t test_etime_iface.f90 >& /dev/null && a=${a}1 || a=${a}0 ;\
> rm -f t *.o ;\
> echo "$a <- $c" ;\
> done
NY
10 <- gfortran
01 <- ifort
00 <- nagfor
11 <- pathf95
01 <- pgf95
11 <- g95
01 <- sunf95
--
The above table tells us if each compiler succeeded (1) or failed (0) compiling
the code without (N) or with (Y) an explicit etime interface. Without the
explicit interface the outcome is mixed, but every compiler other than gfortran
will successfully compile the code with the explicit interface (if the compiler
provides an etime extension; nagfor doesn't).
The same thing happens if one uses etime as a subroutine (with a second
argument): gfortran is alone in failing to compile the code if there is an
explicit interface. Using etime as a subroutine and not providing an explicit
interface seems to work on all of the above compilers, including gfortran.
This may be true of other extensions or intrinsics - I can run specific tests
with other compilers if this would be helpful.