Closed arporter closed 1 year ago
This is with the OpenMPI header file.
All that the OpenMPI header file actually has in it is a bunch of INCLUDE statements. The one that causes problems is mpif-sizeof.h
. If I manually inline it then it parses fine.
I can strip this file down until all that it contains is:
INTERFACE MPI_Sizeof
SUBROUTINE MPI_Sizeof_character_scalar(x, size, ierror)
CHARACTER::x
INTEGER, INTENT(OUT) :: size
INTEGER, INTENT(OUT) :: ierror
END SUBROUTINE MPI_Sizeof_character_scalar
END INTERFACE MPI_Sizeof
and this still reproduces the error. If I replace the INTERFACE block with e.g. INTEGER mpi_comm_world
then it parses fine. (The NVIDIA compiler is happy with the stripped down code containing the INTERFACE block.)
If I make both the top file and the include file free format (and tell the parser that it is free format) then the error still happens.
It turns out that when I last touched the 'include' functionality and 'tidied up' some of the code (https://github.com/stfc/fparser/pull/387/files#diff-45028ec9e913fdcc947a7dd36119c30a5c24c10922d285cae392f7acb6e1152f) I broke it. Now, the reader returns lines from the INCLUDE file in the opposite order! Presumably this is after a match has failed as we have test_readfortran.py::test_include2
which tests the reader only for pretty much the exact case we have here (mpif_sizeof.h)
. If I revert the code that handles reading from include files to the original form in the aforelinked diff then the parse is successful.
I've reverted to the old way of handling INCLUDE files and that fixes the current problem but also breaks the expected ordering of lines when an INCLUDE has an in-line comment. I'm wondering whether I can fix the put_item
so that it always puts it in the FIFO of the 'innermost' reader object and then maybe I don't need to revert the other code?
Parsing the following code:
with the include path set to find the NVIDIA mpi header files gives:
irrespective of whether the reader is set to free or fixed format.