[J3] Question about "Ambiguous interfaces in generic interface"
jehammond at nvidia.com
Fri Oct 7 13:36:52 UTC 2022
I am trying to understand why GCC Fortran (12.2) rejects this code, whereas Cray and Intel are happy with it (and NVHPC is too, if I use something other than type(*)).
As best I can tell, GCC has been buggy in this respect since 4.8 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66409), which seems like a staggering amount of time to not support something like this, so I wonder if there is some ambiguity in how strict the standard is here (https://stackoverflow.com/questions/66260342/problem-with-ambiguous-interfaces-with-gfortan suggests so).
I changed buf to all sorts of things to no avail, so it seems that gfortran cannot tolerate any other interface when one of them is of the form of the second.
PS Yes, Bill, I know this is not the correct signature of MPI_Bcast. This is an MCVE.
use iso_c_binding, only: c_int, c_ptr
module procedure MPI_Bcast_f08
module procedure MPI_Bcast_f08ts
end interface MPI_Bcast
type(c_ptr) :: buf
end subroutine MPI_Bcast_f08
type(*), dimension(..), intent(inout) :: buffer
end subroutine MPI_Bcast_f08ts
end module mpi_coll_f
$ ifort -std18 -c confused.F90 && echo OK
% gfortran-12 -std=f2018 -c confused.F90
12 | subroutine MPI_Bcast_f08(buf)
16 | subroutine MPI_Bcast_f08ts(buffer)
Error: Ambiguous interfaces in generic interface 'mpi_bcast' for 'mpi_bcast_f08' at (1) and 'mpi_bcast_f08ts' at (2)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the J3