Declaration of constant character array fails

Tested with

❯ nvfortran -V

nvfortran 21.3-0 LLVM 64-bit target on x86-64 Linux -tp haswell 
NVIDIA Compilers and Tools
Copyright (c) 2020, NVIDIA CORPORATION.  All rights reserved.
❯ uname -a
Linux saw8203 5.10.32-1-MANJARO #1 SMP Wed Apr 21 14:54:10 UTC 2021 x86_64 GNU/Linux

Minimal reproducer is given with

character(len=*), parameter :: str(*) = &
   & [character(len=20) :: "one", "two", "three"]
end

Compilation fails with

❯ nvfortran mwe.f90
NVFORTRAN-S-0000-Internal compiler error. size_of: attempt to get size of assumed size character       0  (mwe.f90: 1)
  0 inform,   0 warnings,   1 severes, 0 fatal for MAIN

Expected outcome is compilation of this valid Fortran program.

Thanks. I was able to reproduce the issue and have filed a problem report, TPR #30168

1 Like