detecting interface mismatches
Damian Rouson
damian@sourceryinstitute.org
Fri Oct 7 19:50:00 GMT 2016
All,
gfortran does not detect mismatches between a function implementation a submodule and the corresponding interface body in the parent module? See below. I have not checked the standard for a corresponding constraint to determine whether the compiler is required to catch such a mismatch, but if it’s not required, it would be a great feature to have. This problem was identified by a student in a course I’m teaching.
Damian
$ cat one.f90
module one_module
implicit none
interface
module function one()
end function
end interface
end module
submodule(one_module) one_submodule
implicit none
contains
integer module function one()
one = 1
end function
end submodule
use one_module
print *,one()," is not ",1
end
$ gfortran one.f90
$ ./a.out
9.18340949E-41 is not 1
$ gfortran --version
GNU Fortran (MacPorts gcc6 6.1.0_0) 6.1.0
________________________________
Damian Rouson, Ph.D., P.E.
President, Sourcery Institute
http://www.sourceryinstitute.org
+1-510-600-2992 (mobile)
More information about the Fortran
mailing list