[Bug fortran/91556] Problems with better interface checking
anlauf at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Aug 30 19:43:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91556
--- Comment #19 from anlauf at gcc dot gnu.org ---
(In reply to Thomas Koenig from comment #18)
> (In reply to anlauf from comment #14)
> > The current solution is a bit annoying for implicitly-derived interfaces.
> >
> > Consider a code like:
> >
> > module foo
> > implicit none
> > type t1
> > integer :: i = 1
> > end type t1
> > type t2
> > integer :: j = 2
> > end type t2
> > contains
> > subroutine s1 (x)
> > type(t1) :: x
> > call my_mpi_bcast_wrapper (x, storage_size (x)/8)
> > end subroutine s1
> > subroutine s2 (y)
> > type(t2) :: y
> > call my_mpi_bcast_wrapper (y, storage_size (y)/8)
> > end subroutine s2
> > end module foo
> >
> > That's perfectly legal,
>
> This is illegal, as far as I know. The type names are different,
> which makes them different types.
Of course the types are different - that's the point!
The above is an attempt to extract a self-contained example demonstrating
what does happen in real-world codes using MPI. You can convert it to the
real thing yourself (see e.g. man mpi_bcast).
What I wanted to say: in many codes using MPI, the 'buffer' argument of MPI_*
can be of any type or kind, provided the other arguments are appropriately
set. There is no explicit interface - the library routines may not even be
written in Fortran - and there cannot be any reasonable inference from an
implicit interface. Using this to generate an error *by default* is not a
good idea.
The same problem shows up for me in parts of the code using direct calls to
BLAS (again, no explicit interfaces), or to NetCDF. I guess this is similar
to the issues people reported for the SPEC codes.
The recommendation to use -fallow-argument-mismatch to downgrade this to a
warning (not silence it!) does not really solve the issue: the signal-to-noise
ratio of gfortran warnings has become close to useless. (Just ask colleagues
whether they pay attention to warnings.)
And do you really want users to add -w to the list of options?
If you think about it, you might conclude that this will do gfortran a
poor service.
I'll stop ranting now.
More information about the Gcc-bugs
mailing list