Length parameter not copied in pointer rank remapping

I’d like to report a bug in the 18.4 compiler. In the following example, the pointer assignment, which involves rank remapping, does not properly define the length parameter of the pointer object; see F2008 5.3.14 #3. Key to the error is that the target is a deferred-length allocatable.

$ pgfortran pgi-ptr-rank-remap-1.f90
[nnc@omega pgi-bugs]$ ./a.out
len=65538 (expect 3)
1


character(:), allocatable, target :: array(:)
character(:), pointer :: ptr(:,:)
allocate(array(1), source=['foo'])
ptr(1:1,1:1) => array ! THIS IS NOT DONE CORRECTLY
print '(a,2(i0,a))', 'len=', len(ptr), ' (expect ', len(array), ')'
if (len(ptr) /= len(array)) stop 1
end

Hi NeilC,

I was able to reproduce this issue here and have created TPR#25699 and sent to engineering for further investigation.

Thanks!
Mat