Nvfortran ICE on do-concurrent

The following code:

module dummy
contains
  pure function tolower(str) result(lc)
    character(*), intent(in) :: str
    character(len(str)) :: lc
    integer :: i, c
    do concurrent (i = 1:len(str))
       c = ichar(str(i:i))
       if(c > 64 .and. c < 91) c = c + 32
       lc(i:i) = char(c)
    end do
  end function tolower
end module dummy


subroutine foo(names, n)
  use dummy
  implicit none

  integer, intent(in) :: n
  character(32), intent(in) :: names(n)
  character(32) :: copy(n)
  integer :: i

  do concurrent (i = 1:n)
  !do i = 1,n                                                                   
     copy(i) = tolower(names(i))
  end do
end subroutine foo

causes the following ICE:

NVFORTRAN-S-0000-Internal compiler error. size_of: attempt to size assumed size character       0  (docon.f90: 29)
  0 inform,   0 warnings,   1 severes, 0 fatal for foo

On x86 nvfortran 22.1. Switching to a regular do-loop (commented statement) works as expected. Seems to have to do with the compiler (attempting to?) inlining the pure function, as this ICE doesn’t appear if the function definition isn’t available (e.g. just a pure interface statement).

Just for future reference, is it okay to post reproducers here?

Thanks,
Paul

Thanks Paul. Although we a few other open issues with the same ICE, I opened a new problem report, TPR #31245, since it’s slightly different with the use of DO CONCURRENT.

-Mat

1 Like

Hi Paul,

Engineering let me know that TPR#31245 has been fixed. However when I tested the fix, a different error will occur if you are targeting the GPU, presumably due our lack of support for character arrays on the device. Hence I added another report, TPR #31543, for this issue. Targeting multicore CPU (-stdpar=mutlicore) should be ok.

-Mat

1 Like