This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
detecting interface mismatches
- From: Damian Rouson <damian at sourceryinstitute dot org>
- To: GCC-Fortran-ML <fortran at gcc dot gnu dot org>
- Cc: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Date: Fri, 7 Oct 2016 12:49:57 -0700
- Subject: detecting interface mismatches
- Authentication-results: sourceware.org; auth=none
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)