https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128785

            Bug ID: 128785
           Summary: libgfortran's internal MPI implementation of the
                    libcaf API is obsolete
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mikael at gcc dot gnu.org
  Target Milestone: ---

The file libgfortran/caf/mpi.c defines _gfortran_caf_register as:
  _gfortran_caf_register (size_t size, caf_register_t type, caf_token_t *token,
                          int *stat, char *errmsg, size_t errmsg_len,
                          int num_alloc_comps __attribute__ ((unused)))
but libcaf.h declares the interface as:
  void _gfortran_caf_register (size_t, caf_register_t, caf_token_t *,
                               gfc_descriptor_t *, int *, char *, size_t);
so there is a missing array descriptor argument in fourth position, and an
extra unused argument in seventh position in the mpi implementation.

Opencoarrays [1] defines the interface with:
  #ifdef GCC_GE_7
  void PREFIX(register)(size_t, caf_register_t, caf_token_t *, gfc_descriptor_t
*,
                        int *, char *, charlen_t);
  void PREFIX(deregister)(caf_token_t *, int, int *, char *, charlen_t);
  #else
  void *PREFIX(register)(size_t, caf_register_t, caf_token_t *, int *, char *,
                         int);
  void PREFIX(deregister)(caf_token_t *, int *, char *, int);
  #endif
which matches libcaf.h

I think it is the Opencoarrays project that has an MPI implementation with the
right interface; the implementation in libgfortran/caf/mpi.c doesn't match the
interface; the file isn't mentioned in Makefiles; so I think it can just be
removed.

[1]
https://github.com/sourceryinstitute/OpenCoarrays/blob/fba9cfed095fb39b4926fae7c3cf81abed6ed6fd/src/application-binary-interface/libcaf.h#L253-L261

Reply via email to