https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91443
Bug ID: 91443 Summary: -Wargument-mismatch does not catch mismatch for global procedure Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: tkoenig at gcc dot gnu.org Target Milestone: --- The argument mismatch for this code module x contains subroutine a call foo(1) end subroutine a end module x subroutine foo(a) real :: a print *,a end subroutine foo program main use x call a end program main is not caught; for this subroutine foo(a) real :: a print *,a end subroutine foo module x contains subroutine a call foo(1) end subroutine a end module x program main use x call a end program main it is. The problem is that, during resolution of the module, the subroutine foo has not even been parsed yet. Also, the global symbol for foo is not updated during parsing / resolution. We need to solve this if we ever want to get rid of the double declaration problem, see PR 40976 and friends. The best way would probably be to add a "global symbol fixup" pass after everything in the translation unit has been resolved. Warnings about mismatching arguments could also be done then, when we have all the information.