https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61404
Bug ID: 61404 Summary: Incorrect error message when misusing a structure component + explicit interface Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: bardeau at iram dot fr Dear gfortran developers, gfortran issues an incorrect error message using the (invalid on purpose) program below. It refers to the module providing the structure component, instead of the actual line where the error lies (CALL statement). The bug is observed with gfortran 4.9.0 but I also found it in gfortran 4.4.7, so it seems to be here since a long time... module gbl_message type :: mytype integer(kind=4) :: e end type mytype type(mytype), parameter :: seve = mytype(1) end module gbl_message ! module gbl_interfaces interface subroutine gagout(message) character(len=*), intent(in) :: message end subroutine gagout end interface end module gbl_interfaces ! program test use gbl_message use gbl_interfaces ! Make an incorrect call according to the interface: call gagout(seve%e,'Some string') end program test $ gfortran -v Using built-in specs. COLLECT_GCC=gfortran Target: x86_64-unknown-linux-gnu Configured with: ./configure --with-gmp=... --prefix=... --enable-languages=c,c++,fortran Thread model: posix gcc version 4.9.0 (GCC) $ gfortran test.f90 test.f90:17.6: use gbl_message 1 Error: Type mismatch in argument 'message' at (1); passed INTEGER(4) to CHARACTER(1) You can see that the error message refers to the USE statement instead of the CALL statement. If I change the line call gagout(seve%e,'Some string') by call gagout(1,'Some string') the error message is now correct. Sebastien