| Issue |
167222
|
| Summary |
Bug in handling of Fortran TYPE SELECT
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
swenczowski
|
Dear LLVM developers,
I believe that I have encountered the following bug, which occurs in the context of the Fortran SELECT TYPE framework. Please, find a small reproducer attached (Fortran file, renamed to ".txt" in order to attach -> [main.txt](https://github.com/user-attachments/files/23439905/main.txt)).
A function receives an array of unspecified type. Inside that function, a SELECT TYPE choses different function calls (here MPI calls, OpenMPI 4.1.8, compiled with LLVM 21.1.5) depending on the type of the array. While the compiler seems to be aware of the type of the array if the array is handed over to the function, the type information seems to be forgotten if any entry of the array specified by an index is handed over. That means
`
SELECT TYPE(arr)
TYPE IS (INTEGER)
IF (rank == 0) THEN
CALL MPI_recv( arr, count, MPI_INTEGER, 1, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE )
ELSE IF (rank == 1) THEN
CALL MPI_Send( arr, count, MPI_INTEGER, 0, tag, MPI_COMM_WORLD )
END IF
TYPE IS (REAL)
IF (rank == 0) THEN
CALL MPI_recv( arr, count, MPI_REAL, 1, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE )
ELSE IF (rank == 1) THEN
CALL MPI_Send( arr, count, MPI_REAL, 0, tag, MPI_COMM_WORLD )
END IF
END SELECT
`
works, while
`
SELECT TYPE(arr)
TYPE IS (INTEGER)
IF (rank == 0) THEN
CALL MPI_recv( arr(3), count, MPI_INTEGER, 1, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE )
ELSE IF (rank == 1) THEN
CALL MPI_Send( arr(3), count, MPI_INTEGER, 0, tag, MPI_COMM_WORLD )
END IF
TYPE IS (REAL)
IF (rank == 0) THEN
CALL MPI_recv( arr(3), count, MPI_REAL, 1, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE )
ELSE IF (rank == 1) THEN
CALL MPI_Send( arr(3), count, MPI_REAL, 0, tag, MPI_COMM_WORLD )
END IF
END SELECT
`
fails with the following error
simon@vivo:~/Software/reproducer_01_llvm+openmpi$ mpifort main.F90 -o reproducer.exe
error: Semantic errors in main.F90
./main.F90:41:17: error: No specific subroutine of generic 'mpi_recv' matches the actual arguments
CALL MPI_recv( arr(3), count, MPI_INTEGER, 1, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./main.F90:43:17: error: No specific subroutine of generic 'mpi_send' matches the actual arguments
CALL MPI_Send( arr(3), count, MPI_INTEGER, 0, tag, MPI_COMM_WORLD )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./main.F90:47:17: error: No specific subroutine of generic 'mpi_recv' matches the actual arguments
CALL MPI_recv( arr(3), count, MPI_REAL, 1, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
./main.F90:49:17: error: No specific subroutine of generic 'mpi_send' matches the actual arguments
CALL MPI_Send( arr(3), count, MPI_REAL, 0, tag, MPI_COMM_WORLD )
I hope that I am not violating any aspect of the Fortran standard. Also, I could confirm that the GCC-13 and the Intel-2025.1 compilers could successfully compile a fully functional executable.
Being able to use LLVM as a further compiler would be great, such that I would highly appreciate your attention in this concern.
With best regards,
Simon
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs