-
Notifications
You must be signed in to change notification settings - Fork 280
-
Notifications
You must be signed in to change notification settings - Fork 280
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
bug: F08 makes array 0-based instead of the original 1-based #4170
Comments
Follow up:
Test with:
|
I probably will look into it further and identify the exact issue, but it appears to be an issue with current Cross referencing in issue #3820, there reveals also a discrepancy related to the Fortran iso-c-binding between |
Hello there, any updates on this? |
@pedro-ricardo We believe at this point this is an issue of |
Can it be isolated from MPICH and submitted as a issue to gcc? Do you intend on making a workaround to enable |
The answer is probably yes. It will take some time (and unfortunately, some priority). Any help will be appreciated. If you would like to help, feel free to feed back to us on your effort. We'll be happy to discuss and provide pointers.
The work-around is to skip iso-c-binding and do it in a similar way as the f90 modules. Of course, doing that defeats the original purpose of the f08 interface -- for its stronger type checking. |
@pedro-ricardo: Have you submitted the bug to GCC yet? |
Hello @gcorbin, No I did not. |
Minimum reproducer:
Run with:
Results:
EDIT: also reproduced with |
Reported to GCC bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104100 |
It will be fixed in the upcoming gcc-12.0 according to the reply in the above bugzilla report. |
It is reported by a user on
discuss@mpich.org
:Hi there, My name is Pedro Ricardo and I'm currently a researcher at a Fluid Dynamics Laboratory in Brazil.
We have a CFD software with 12 continuous years of development mostly in Fortran, and we've been using Mpich and Openmpi since the very beginning.
Recently we started to refactor the code and write it using Fortran2008 standard and this includes the usage of the the newest MPI module for Fortran "mpi_f08".
So far no errors were present in Openmpi implementations and everything worked like a charm, but when we started compiling with Mpich lots of errors happened during execution.
I was able so isolate and reproduce the error in a simpler code. Whenever "use mpi_f08" is present, the arrays passed to a MPI subroutine return with C-like indexes. If I allocate an standard array in Fortran (that starts with index 1), after the call of some MPI routine this array come back starting with index 0.
And you can imagine that all access to this array will be wrong after that.
It is a funny behavior because if you put "use mpi" instead of "use mpi_f08", the indexes do not change.
The test is simple, allocate and array, print it's bound indexes, calls a MPI_Reduce routine and print the array bounds again. I've also tested other routines like MPI_ISend and the error also happens.
The text was updated successfully, but these errors were encountered: