Pointer rank remapping


As far as I understand, Fortran 2008 standard lifted the restriction of rank-1 target for pointer rank remapping. I was wondering if this feature is going to be supported anytime soon by the PGI fortran compiler. If I try to compile the code below with pgfortran version 14.7, I get the error

PGF90-S-0155-Illegal POINTER assignment - rank of pointer target must be 1 or equal to rank of pointer object (ptrRankRemap.f90: 26)
0 inform, 0 warnings, 1 severes, 0 fatal for main

The code is:

program main

  implicit none

  integer, parameter :: nRows = 13
  integer, parameter :: nCols = 6
  integer, parameter :: nElts = nRows*nCols

  integer, target :: A(nRows,nCols)
  integer, pointer :: ptr2A(:) => null()

  integer :: i, j

  ! initialize A
  do j=1,nCols
     do i=1,nRows
        A(i,j) = i+(j-1)*nRows
     end do
  end do

  ! print A
  print *, A
  print *, ''

  ! pointer rank remapping
  ptr2A(1:nElts) => A(:,:)

  ! increment elements of A by 1
  ptr2A = ptr2A + 1

  print *, A

end program main


Hi Purnendu,

I will check with our developers on this and let you know.



I checked with our developer, and this feature is currently under investigation. We are currently hoping to get this feature into the 15.1 release, due early next year.

Best regards,


Thanks Chris. I will look forward to the 15.1 release.