http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52452

             Bug #: 52452
           Summary: INTRINSIC cannot be applied to gfortran's ETIME
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: roger.fer...@bsc.es


[Note for a possible duplicate: This bug may be related to #52333, but in that
one EXTERNAL and explicit INTERFACEs are involved (which is not the case in the
current bug).]

gfortran's ETIME can be used either as a FUNCTION or as a SUBROUTINE.

Explicitly specifying that it is an INTRINSIC name (using an
intrinsic-statement) works fine if the function version is used. But when using
the subroutine version, gfortran 4.6.2 complains:

Consider the following testcase

PROGRAM test_etime
    IMPLICIT NONE
    INTRINSIC :: etime
    REAL(4) :: tarray(1:2)
    REAL(4) :: result

    CALL etime(tarray, result)
END PROGRAM test_etime

results in

$ gfortran -c test_etime.f90 
test_etime.f90:3.22:

    INTRINSIC :: etime
                      1
Error: FUNCTION attribute conflicts with SUBROUTINE attribute in 'etime' at (1)

Removing that line the compilation succeeds (and gfortran appropiately emits a
call to _gfortran_etime_sub). Using the function version works too with or
without an INTRINSIC statement.

[Note: I'm aware, as the documentation clearly states, that both forms cannot
be used in a single program unit. I'm just using one of them at a time]

Maybe it is my fault assuming too liberally the meaning of the INTRINSIC
statement/attribute.

Kind regards,

Reply via email to