Closed naromero77 closed 4 years ago
I believe the type of command_c
here is incorrect. It should be an array of c interoperable characters (see in your interface definition for system
), as opposed to a Fortran string.
Change:
character(len=len(command)+1) :: command_c
to:
character(len=1,kind=c_char) :: command_c(len(command)+1)
You will then have to copy the strings a character at a time I think, see s2c for example.
I can confirm that your original code also compiled without warning in latest intel fortran: I'm not sure why this isn't picked-up in the other compilers, so I may be missing something here.
Thanks for looking at the reduced test case. I have verified that your modified code works with Intel, Gfortran, and f18 compilers. At the moment, I cannot compile the full DOE science app because of this unrelated issue: https://github.com/flang-compiler/f18/issues/1020
Let us leave the issue open for now until I can get the application developer to fix it their code. But I will close it as soon as I can.
Original code is fixed and test passing with multiple compilers.
This code snippet is extracted from a much large DOE code. It compiles with gfortran, pgi, (old) flang, but f18 gives:
I am copying and pasting the code below: