ICE: Errors in Lowering for deferred length character in repeat intrinsic

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)
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

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.

Thanks awvwgk! We appreciate the small reproducing example.

I was able to reproduce the errors here and have filed TPR #29343. We’ll have engineering take a look and further evaluate the issue.


1 Like