character parameter issue with pgfortran

Hi,

I am trying to compile the following code (subset of a larger program) that does not contain any cuda/openacc statements

      module nls_var
        character(32),parameter,dimension(3)::tags_Tvel_corr=(/
     &                        "$\overline{\rho u_1^{'}T^{'}}$ "
     &                       ,"$\overline{\rho u_2^{'}T^{'}}$ "
     &                       ,"$\overline{\rho u_3^{'}T^{'}}$ "
     &                                               /)
      end module

with

pgfortran -Mcuda=cuda8.0 -c test_issue.f

and get the following compiler error:

nvvmCompileProgram error: 9.
Error: /tmp/pgaccK5ySq03eYCY.gpu (10, 73): parse constant expression type mismatch
PGF90-F-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (test_issue.f: 1)
PGF90/x86-64 Linux 16.10-0: compilation aborted

After the compilation the temp file is gone so I don’t know what it contains.

The error appears both on a CRAY as well as on my local system. There is no additional output on the terminal. If I leave -Mcuda=cuda8.0 out the compilation works. Also removing the parameter statement in the code solves the issue.

Is this a bug or am I violating the Fortran standard?

Hi rpichler70979,

Looks like the problem is the carriage return, “\r”, in the string. In CUDA Fortran, module parameters are automatically added to the device’s constant memory so they can be accessed from device code. However it appears that the CR is getting parsed incorrectly by the back-end LLVM device compiler. I have added a problem report, TPR#24048, for the parse error.

The work around would be to add the “-Mbackslash” flag which tells the compiler to treat backslashes not as escape characters but as any other character. Note that you may want to use this flag for all compiles anyway, assuming you did not mean to use the CR character in a string.

Another option is to use the CUDA back-end compiler instead of LLVM via the flag "-Mcuda=nollvm.

Thanks for the report!
Mat

Hi Mat,

thanks, the -Mbackslash solved it.

Best regards,
Richard

Hi Richard,

-Mbackslash will work around the problem, though this issue should be resolved in 18.4 CE

  • Alex