Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fortran: ierror keyword argument not handled correctly in Fortran 90 mpi module bindings #6693

Closed
mathomp4 opened this issue Sep 22, 2023 · 1 comment · Fixed by #6694
Closed

Comments

@mathomp4
Copy link

I have some sample code that does not compile with MPICH 4.1.2:

program hello_world
   use mpi
   implicit none
   integer :: status
   call MPI_Init(ierror=status)
   call MPI_Finalize(ierror=status)
end program hello_world

With MPICH:

$ mpifort init_status.F90
init_status.F90:5:24:

    5 |    call MPI_Init(ierror=status)
      |                        1
Error: Keyword argument 'ierror' at (1) is not in the procedure; did you mean 'ierr'?
init_status.F90:6:28:

    6 |    call MPI_Finalize(ierror=status)
      |                            1
Error: Keyword argument 'ierror' at (1) is not in the procedure; did you mean 'ierr'?

Every other stack I try supports this. Per the MPI Standard, I'm pretty sure the Fortran interfaces say the final argument will be IERROR.

Per a colleague of mine (@tclune) on the Fortran Standards Committee:

Explicit interfaces for Fortran procedures include the keywords, i.e., the spelling of the procedure arguments. The use mpi mechanism is intended to provide explicit interfaces to MPI procedures. The MPI standard specifies the final argument is spelled "IERROR", not "IERR".

Note, that this works:

program hello_world
   use mpi
   implicit none
   integer :: ierror
   call MPI_Init(ierror)
   call MPI_Finalize(ierror)
end program hello_world

works because you aren't using keywords. Also, the first program works if you use mpi_f08 because it seems to handle ierror keyword correctly. But the Fortran 90 bindings seem to have been constructed such that it thinks the last argument is called ierr (as in C) and not ierror (as it should be in Fortran).

@hzhou
Copy link
Contributor

hzhou commented Sep 22, 2023

Thank you for the report! We will fix it.

@hzhou hzhou changed the title ierror keyword argument not handled correctly in Fortran 90 mpi module bindings fortran: ierror keyword argument not handled correctly in Fortran 90 mpi module bindings Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants