https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94348
--- Comment #2 from Damian Rouson <damian at sourceryinstitute dot org> ---
Thanks for the quick reply, Steve. My apologies for not providing any text. I
dashed this off during a call with the person who reported the problem to me.
I think the code is legal, but I'm very open to the possibility that I'm wrong
here. It's hard to understand the relevant parts of the standard. The Intel
compiler accepts the code, but the NAG compiler gives an error message similar
to gfortran, which is a strong hint that it could be invalid code. What's
confusing is that moving the procedure definition to a submodule works with
gfortran:
$ cat foo.f90
module foo_module
implicit none
interface
module function foo() result(bar)
implicit none
integer bar
end function
end interface
end module
submodule(foo_module) foo_submodule
implicit none
contains
module procedure foo
bar = 0
end procedure
end submodule
use foo_module, only : foo
implicit none
print *,foo()
end
$ gfortran foo.f90
$ ./a.out
0
Thoughts?