The following program is rightly rejected. But the problem is not really that the ranks are different (as the example shows for "i", which is valid). The issue is that "j" is a scalar. -- A user might also not be that familiar the concept that a rank-0 array is equivalent to a scalar.
gfortran shows: Error: Rank mismatch in argument 'i' at (1) (1 and 0) other compiles have, e.g. Error: Cannot pass scalar to array argument 'i' at (1) Error: Scalar supplied for array argument I (no. 1) of SUB Illegal association of a scalar actual argument with array dummy argument "I". error #7836: If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element. [I] Though I'm not sure whether one needs to be as long as ifort. Cool stuff: If one changes the "contains" into "end" and removes the last line, gfortran -fwhole-file still detects the violated constraint, while ifort, g95, openf95 miss it. NAG f95 also detects it. implicit none integer :: i(4,5),j i = 0 call sub(i) call sub(j) ! Wrong scalar passed to array print '(5i0)', i contains subroutine sub(i) integer :: i(*) i(1) = 2 end subroutine sub end -- Summary: Misleading error message for passing a scalar to an array Product: gcc Version: unknown Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40158