Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Result -f -gen-interface

albert
Beginner
494 Views
When I use the -gen-interface option I would expect that the resulting interface definition is startdard conform. This is not the case. In my subroutine definition I have a parameter i of type integer. I would expect in the interface definition to have I of type integer as well, but is is of integer(kind=4). For the Intel compiler this might be identical but this is not standard conforming (see also http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/Kind-Notation.html).

My input file is:
===========
Module interf_tst
INTEGER, PARAMETER :: dp=kind(1.0D0)
end module

subroutine tst_interf(i, r, d, p)
use interf_tst
implicit none

integer :: i
real :: r
double precision :: d
real(kind=dp) :: p
end

Resulting interface file:
==================
!COMPILER-GENERATED INTERFACE MODULE: Mon Mar 21 14:59:15 2011
MODULE TST_INTERF__genmod
INTERFACE
SUBROUTINE TST_INTERF(I,R,D,P)
INTEGER(KIND=4) :: I
REAL(KIND=4) :: R
REAL(KIND=8) :: D
REAL(KIND=8) :: P
END SUBROUTINE TST_INTERF
END INTERFACE
END MODULE TST_INTERF__genmod

Expected interface fle:
=================
!COMPILER-GENERATED INTERFACE MODULE: Mon Mar 21 14:59:15 2011
MODULE TST_INTERF__genmod
INTERFACE
SUBROUTINE TST_INTERF(I,R,D,P)
INTEGER :: I
REAL :: R ! or REAL(KIND=.0E0) :: R
DOUBLE PRECISION :: D ! or READ(KIND=.0D0) :: D
REAL(KIND=dp) :: P
END SUBROUTINE TST_INTERF
END INTERFACE
END MODULE TST_INTERF__genmod


Fortran compiler version: c11.1.059_f11.1.059

Best regards,

Albert





0 Kudos
3 Replies
Steven_L_Intel1
Employee
494 Views
Albert,

I think you misunderstand the use of -gen-interface. This is part of the Intel compiler's "interface checking" diagnostic feature and is not intended as a general purpose mechanism for creating portable interfaces. The kind is part of the interface because when you compiled TST_INTERF, default integer was kind 4. The generated .f90 is really just a side-effect for your reference and is not used by the compiler.

In any case, the use of KIND=4 certainly is standard-conforming, though it may not be portable since kind values are implementation-dependent.
0 Kudos
albert
Beginner
494 Views
Steve,

I know that the compiler is not using the generated .f90 file (and I don't think it wil use the mod file either, not sure about this it might be used for other routines in the same source file). It would be nice if the compiler would generate portable interfaces. I have to read up on the "interface checking" diagnostic feature, but I could not find the required manual (and our system administrator didn't install it as far as I know).

I do agree that it is standard conforming, I should have used the word portable instead.

Albert
0 Kudos
Steven_L_Intel1
Employee
494 Views
The .mod is certainly used. If -warn interface is enabled (this implies -gen-interface as of 11.1) and the compiler runs across a reference to a procedure for which there is no explicit interface visible, it looks to see if there is a generated module for that procedure. If so, it uses it to perform error checking (it is not a substitute for a user-provided explicit interface where the language requires it.)

I don't think it's possible to install the compiler without the documentation.
0 Kudos
Reply