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

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.

-Mat

1 Like

I’m still hitting this bug in NVHPC 21.3. What is the status of this issue?

Sorry, no progress on this one either. I’ll poke them and see if we can get some movement on these.

1 Like

Still hitting this issue with 21.11, any updates on this.

No update, Usually they are good at getting user issues fixed quicker then this, not sure why this one hasn’t been address as of yet. I reassigned the issue to the compiler team’s manager to see if we can push this to a higher priority.

Thanks for looking into this. I was hoping to finally be able to give nvfortran a try again, but I’m still hitting the same bugs.

Hi Awvwgk,

Engineer let me know that TPR#29343 was fixed in our 22.3 release.

-Mat