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