(j3.2006) TYPE(*) and scalars
Rasmussen, Craig E
Wed Mar 21 12:42:10 EDT 2012
The MPI-3 Fortran subcommittee has been having a discussion with Tobias regarding the use of TYPE(*). There is a potential problem for the MPI-3 standard, in the interim, until compilers implement assumed rank. The issue regards needing two generic interfaces (one for scalars and one for arrays) if TYPE(*) is used WITHOUT assumed rank (for example, Tobias has already added TYPE(*) to gfortran but assumed rank will obviously take more time). Other compilers use some sort of IGNORE_TKR directive that allows scalar actual arguments. However, Tobias doesn't think TYPE(*) alone should allow this behavior.
So I'm not putting words in Tobias' mouth, here is his comments from earlier emails:
> However, without "dimension(*)" you may not pass an array (or array section) and with "dimension(*)" you may not pass a scalar as argument. (* with exceptions for strings and array elements.)
> See Fortran 2008 standard:
> "If the actual argument is a noncoindexed scalar, the corresponding dummy argument shall be scalar unless the actual argument is default character, of type character with the C character kind (15.2.2), or is an element or substring of an element of an array that is not an assumed-shape, pointer, or polymorphic array." (188.8.131.52p13)
> "A scalar dummy argument of a nonelemental procedure shall correspond only to a scalar actual argument." (184.108.40.206p16)
> I don't think that TS 29113 changes this - except for assumed-rank dummies ("dimension(..)").
This is actually critical to the MPI-3 Fortran standard as we really can't pollute the FORTRAN namespace with two generic interfaces as we have to publish the "well known name" of the interface implementation so that it really can't be generic.
Advice would be appreciated.
FYI. We have released a tarball for the Open MPI implementation of the new MPI-3 Fortran standard. In case there are any vendors who wish to try this beta please let Jeff Squyres know. Several vendors have already tried this beta release and have fixed bugs in their compilers.
More information about the J3