ICE in nvfortran for iso_c_binding

Hi,

I have encountered an internal compiler error in nvfortran, version 22.3.0, from the HPC SDK. Compiling the small code snippet

function cpp_to_str () bind (C) result (c)
  use iso_c_binding
  character(c_char) :: c
end function cpp_to_str

leads to this error message:

pgfortran-Fatal-/home/cweiss/build/pgi_sdk/Linux_x86_64/22.3/compilers/bin/tools/fort2 TERMINATED by signal 11
Arguments to /home/cweiss/build/pgi_sdk/Linux_x86_64/22.3/compilers/bin/tools/fort2
/home/cweiss/build/pgi_sdk/Linux_x86_64/22.3/compilers/bin/tools/fort2 /tmp/nvfortranaWl_arhSwM9q.ilm -fn test_iso_c_binding.f90 -opt 1 -terse 1 -inform warn -x 51 0x20 -x 119 0xa10000 -x 122 0x40 -x 123 0x1000 -x 127 4 -x 127 17 -x 19 0x400000 -x 28 0x40000 -x 120 0x10000000 -x 70 0x8000 -x 122 1 -x 125 0x20000 -quad -x 59 4 -tp skylake-avx512 -x 120 0x1000 -x 124 0x1400 -y 15 2 -x 57 0x3b0000 -x 58 0x48000000 -x 49 0x100 -astype 0 -x 121 1 -x 183 4 -x 121 0x800 -x 68 0x1 -x 8 0x40000000 -x 70 0x40000000 -x 56 0x10 -x 54 0x10 -x 249 130 -x 68 0x20 -x 70 0x40000000 -x 8 0x40000000 -x 164 0x800000 -x 85 0x2000 -x 85 0x4000 -x 34 0x40000000 -x 53 0x800000 -x 83 0x1 -x 84 0x3c7 -x 85 0x1 -x 206 0x02 -x 68 0x1 -x 39 4 -x 56 0x10 -x 26 0x10 -x 26 1 -x 56 0x4000 -x 124 1 -y 163 0xc0000000 -x 189 0x10 -y 189 0x4000000 -cci /tmp/nvfortranaWl_azbTtESt.cci -cmdline '+pgfortran test_iso_c_binding.f90 -c' -stbfile /tmp/nvfortranaWl_aHm1F2nR.stb -asm /tmp/nvfortranaWl_abdyLEHC.ll

Can you confirm this? Do you know if there is a workaround?

Best regards,
Christian

Thanks Christian, I was able to reproduce the error here and have filed a problem report, TPR #32289.

The error seems to only occur with the combination of both ‘bind(C)’ and a function returning a character. Not sure it would work in the context of your larger program, but one possible workaround would be to use a “integer(c_signed_char)” type instead of “character(c_char)”.

% cat test1.f90
function cpp_to_str () bind(C) result(c)
  use iso_c_binding
  integer(c_signed_char) :: c
end function cpp_to_str
% nvfortran test1.f90 -c -V22.3
%

-Mat

Hi Mat,

thanks for your reply and filing the problem report.
I will try out changing to integer types, but might be difficult to include in the rest of the code.

Best regards,
Christian