POINTER attribute and Generic Interfaces

POINTER attribute and Generic Interfaces

russell66's picture

I have a generic Interface for a set of functions, some of which differ only by one argument having the POINTER attribute, as opposed to having the INTENT(IN) attribute..

under What conditions should the POINTER Function be
called? From what I am seeing, it isn't.

example Code:
INTERFACE WrDbgArray
MODULE PROCEDURE WrReal1dArray
MODULE PROCEDURE WrReal1dPtrArray
MODULE PROCEDURE WrReal2dArray
END INTERFACE

SUBROUTINE WrReal1DArray(name,array, idbg)
CHARACTER(LEN=*), INTENT(IN) :: name
REAL(sdk), DIMENSION(:), INTENT(IN) :: array
INTEGER(sik), INTENT(IN) :: idbg

SUBROUTINE WrReal1DPtrArray(name,array, idbg)
CHARACTER(LEN=*), INTENT(IN) :: name
REAL(sdk), DIMENSION(:), POINTER :: array
INTEGER(sik), INTENT(IN) :: idbg


Should this be a syntax error???
The code using this compiles and runs, but ALWAYS chooses
WrReal1dArray for 1d arrays...

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Steve Lionel (Intel)'s picture

What compiler and version are you using? CVF 6.6A disallows this - the generic is ambiguous. Neither POINTER nor INTENT are distinguishing characteristics of a generic procedure.

Steve

Steve
russell66's picture

This is CVF 6.6A-

no syntax Error... the files are attached - simplified to minimize dependencies. IntrTypeM.f90 defines portable
INTEGER and REAL types, DebugUtilSimplifiedM.f90 contains
the Generic interface WrDbgArray which has 2 instances each of function for 1 and 2 dimensional integers, 1 and 2 dimensional reals and 1 dimensional Character strings.

Login to leave a comment.