! In this program, gfortran fails to identify the generic interface sub for ! sub_int. The compiler gives this error message: ! ! > gfortran prog.f90 ! prog.f90:40.9: ! ! call sub(1) ! 1 ! Error: Type mismatch in argument 'x' at (1); passed INTEGER(4) to REAL(4) ! ! However, if the use statements in program prog are switched so that ! use mod2 comes before use mod1, it correctly identifies the generic ! interface and compiles. ! ! This is with the following version of gfortran: ! > gfortran --version ! GNU Fortran (GCC) 4.5.0 20091205 (experimental) [trunk revision 155016]
module mod1 contains subroutine sub(x) real x end subroutine sub end module mod1 module mod2 use mod1 interface sub module procedure sub, sub_int end interface sub contains subroutine sub_int(i) integer i end subroutine sub_int end module mod2 program prog use mod1 use mod2 call sub(1) end program prog -- Summary: generic interface not recognized Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: william dot mitchell at nist dot gov http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42481