http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46310
Summary: gfortran wrongly treats INTERFACE BLOCK and not
INTERFACE BODY as scoping unit
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Reported by Damian at http://gcc.gnu.org/ml/fortran/2010-11/msg00081.html /
http://gcc.gnu.org/ml/fortran/2010-11/msg00082.html
Reduced example:
!---------------------------------
module foo_module
implicit none
interface
real function func_interface()
end function
subroutine bar_interface(f)
implicit none
procedure(func_interface), intent(in) :: f
end subroutine
end interface
end module
!---------------------------------
The program is invalid without "import func_interface".
The reason is that not the interface block but the interface body is a scoping
unit and host association only occurs using the IMPORT statement.
While many compilers (crayftn, nagf95, xlf, g95) correctly reject the program,
gfortran happily compiles it.
Fortran 2008 defines:
"1.3.124 scoping unit -- BLOCK construct, derived-type definition, interface
body, program unit, or subprogram, excluding all nested scoping units in it"