Starting with PR 40039, gfortran checks the INTENT of procedures. This works - especially with the patch for PR 36947/PR 40039 - rather well if one calls a SPECIFIC procedure.
However, if one calls a GENERIC procedure the error message is just: Error: There is no specific subroutine for the generic 'gen' at (1) The issue is: There is already a matching specific procedure, it just has the problem that the INTENT is wrong. If one checks for GENERIC procedures, one should continue checking the interface and if everything except of the INTENT matches, one should print an error message. Otherwise one can search for ages for the problem. NAG f95 prints for the example: Error: line 14: Dummy proc A arg 1 has different INTENT from actual proc SUB arg Error: line 14: Incompatible procedure argument for A (no. 1) of SPECIFIC Example: ----------------------------- module m implicit none interface gen subroutine specific(a) interface subroutine a(x) integer, intent(in) :: x end subroutine a end interface end subroutine specific end interface gen contains subroutine test() call gen(sub) end subroutine test subroutine sub(a) integer, intent(inout) :: a end subroutine sub end module m ----------------------------- * * * Without NAG f95 I would not have easily found the problem for the real-world program (now fixed). To show bad the error message is, here the interface (from octopus, see http://www.tddft.org). The problem was that the actual argument to "f" had for "val" intent(inout) instead of "intent(out)". interface loct_minimize function oct_minimize(method, dim, x, step, tolgrad, toldr, maxiter, f, & write_iter_info, minimum) integer :: oct_minimize integer, intent(in) :: method integer, intent(in) :: dim real(8), intent(inout) :: x real(8), intent(in) :: step integer, intent(in) :: maxiter real(8), intent(in) :: tolgrad real(8), intent(in) :: toldr real(8), intent(out) :: minimum interface subroutine f(n, x, val, getgrad, grad) integer, intent(in) :: n real(8), intent(in) :: x(n) real(8), intent(out) :: val integer, intent(in) :: getgrad real(8), intent(out) :: grad(n) end subroutine f subroutine write_iter_info(iter, n, val, maxdr, maxgrad, x) integer, intent(in) :: iter integer, intent(in) :: n real(8), intent(in) :: val real(8), intent(in) :: maxdr real(8), intent(in) :: maxgrad real(8), intent(in) :: x(n) end subroutine write_iter_info end interface end function oct_minimize end interface -- Summary: Matching GENERIC procedure: Wrong INTENT should give directly an error message Product: gcc Version: 4.5.0 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=40276