https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96320
--- Comment #8 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Sun, Jul 26, 2020 at 09:35:56PM +0000, jvdelisle at charter dot net wrote: > > I my too simple terms, when you define the interface and then use > module procedure in the contains, all of the declarations in the > interface exist as if you had them in the declaration of the > subroutine or function in the contains. This includes all arguments > and whether or not the procedure is a subroutine or a function. > > I was not aware of this either untill I saw some other code > Damian was doing earlier this week that does actually compile > fine like this with gfortran. It is a modern feature and if you > think about it, very useful in that it saves a lot of typing. > One can choose do do it either way, but this way shown truly uses > the interface to define everything. > I have thought about it, and I have concluded it is rather curious programming paradigm, because ... module foo private public bar interface bar ! Make bar generic module subroutine bar1(x) real, intent(in) :: x end subroutine bar1 end interface integer x contains ! ! Several hundreds to several thousand lines of code may ! appear here, which separates dummy argument declarations ! from where the dummy arguments are used. ! module procedure bar1 print *, x end procedure bar1 end module foo Oh, and at least, this simply test program works with my 2nd patch. program bah use foo real y y = 42. call bar(y) end program bah Likely, yet another patch that will sit in bugzilla.