Tested with
nvfortran 20.9-0 LLVM 64-bit target on x86-64 Linux -tp sandybridge
NVIDIA Compilers and Tools
Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
The following minimal example demonstrates the issue:
character(len=:), allocatable :: output
call a_proc(output)
contains
subroutine a_proc(str)
character(len=:), allocatable, intent(in) :: str
if (allocated(str)) then
write(*, '(a)') repeat(str, 1)
end if
end subroutine a_proc
end
Running nvfortran
leads to:
nvfortran mwe.f90
Lowering Error: unexpected data type at assignment [ast=43,asttype=17,datatype=0]
Lowering Error: unknown source type for conversion to integer*8 [ast=42,asttype=1,datatype=0]
NVFORTRAN-F-0000-Internal compiler error. Errors in Lowering 2 (mwe.f90: 9)
NVFORTRAN/x86-64 Linux 20.9-0: compilation aborted
The issue seems related to the deferred length character used with the repeat intrinsic. While in the above snippet repeat(str, 1)
redundant, the original application used this approach to handle optional indentation with an integer variable as current depth instead 1
.