10.2.2.1 Problems Due to Strong Typing

All MPI-/ functions with choice arguments associate actual arguments of different Fortran datatypes with the same dummy argument. This is not allowed by Fortran 77, and in Fortran 90 is technically only allowed if the function is overloaded with a different function for each type. In C, the use of void* formal arguments avoids these problems.

The following code fragment is technically illegal and may generate a compile-time error.

  integer i(5)
  real    x(5)
  ...
  call mpi_send(x, 5, MPI_REAL, ...)
  call mpi_send(i, 5, MPI_INTEGER, ...)
In practice, it is rare for compilers to do more than issue a warning, though there is concern that Fortran 90 compilers are more likely to return errors.

It is also technically illegal in Fortran to pass a scalar actual argument to an array dummy argument. Thus the following code fragment may generate an error since the buf argument to MPI_SEND is declared as an assumed-size array <type> buf(*).

  integer a
  call mpi_send(a, 1, MPI_INTEGER, ...)

Advice to users. In the event that you run into one of the problems related to type checking, you may be able to work around it by using a compiler flag, by compiling separately, or by using an MPI-/ implementation with Extended Fortran Support as described in Section 10.2.4. An alternative that will usually work with variables local to a routine but not with arguments to a function or subroutine is to use the EQUIVALENCE statement to create another variable with a type accepted by the compiler.(End of advice to users.)

MPI-Standard for MARMOT