Compiler bug, PGF90/x86 Windows 10.9-0

module jacksort

  implicit none
  integer, parameter :: ncon = 21

  private

  public :: SetErrorFunction

  abstract interface
     pure function error_template2 ( x )
       import :: ncon
       real, dimension(0:, 0:), intent(in) :: x
       real, dimension(ncon)               :: error_template2
     end function error_template2
  end interface

  procedure(error_template2), pointer :: errorfunction2 => null()

contains

  pure function jackerror2 ( x )
    real, dimension(0:, 0:), intent(in) :: x
    real, dimension(ncon)               :: jackerror2   ! <== FN result
    real, dimension(ncon)               :: avg, err
    avg = sum(x(1:ncon, 1:ncon), dim=2) / real(ncon - 1)
    err = sum((x(1:ncon, 1:ncon) - spread(avg, dim=2, ncopies=ncon))**2, dim=2)
    jackerror2 = sqrt(err * real(ncon - 2) / real(ncon - 1))
  end function jackerror2

  subroutine SetErrorFunction ( func )
    character(len=*), intent(in) :: func
    select case( func )
    case( 'jack' )
       errorfunction2 => jackerror2
    case default
       stop 'Unknown error type '
    end select
  end subroutine SetErrorFunction

end module jacksort

causes the compiler to say

PGF90-S-0155-Illegal POINTER assignment - rank mismatch (jck1.f90: 35)
  0 inform,   0 warnings,   1 severes, 0 fatal for seterrorfunction

even though the pointer and pointee are both real, dimension(ncon).

Thanks N. Shamsundar. I have filed a problem report (TPR#17720) and sent it to our engineers.

  • Mat

N. Shamsundar,

The problem Mat submitted as TPR 17720 has been corrected in
the current 11.4 release.

thanks,
dave