[Fortran compiler BUG] Unexpected lowering error

The following program does not compile with PGI version 14.9 with optimizing flags (-fast). Without optimizing flags it does compile, and it compiles with both gfortran and intel fortran.

I get the following error from PGI:

Lowering Error: unexpected data type at load [ast=62,asttype=38,datatype=0]
Lowering Error: unexpected data type at assignment [ast=169,asttype=17,datatype=0]
PGF90-F-0000-Internal compiler error. Errors in Lowering 2 (…/…/./src/test.f90: 7)
PGF90/x86-64 Linux 14.9-0: compilation aborted


program test
  use rk_mod
  call test_1()
contains
  subroutine test_1()
    type(mytype) :: obj
    obj = init(1)
    call sub(obj)
  end subroutine test_1
end program test

module rk_mod
  implicit none
  !
  type :: mytype
    procedure(interf), nopass, pointer :: proc
    real, dimension(:), allocatable :: list
  end type
  !
  interface
    subroutine interf(obj)
      import :: mytype
      type(mytype), intent(inout) :: obj
    end subroutine interf
  end interface
contains
  !----------------------------------------------------------------------------
  function init(n) result(object)
    integer, intent(in) :: n
    type(mytype) :: object
    !
    object%proc => proc1
    allocate(object%list(n))
  end function init
  !----------------------------------------------------------------------------
  subroutine sub(obj)
    type(mytype), intent(inout) :: obj
    !
    call obj%proc(obj)
  end subroutine sub
  !----------------------------------------------------------------------------
  subroutine proc1(obj)
    type(mytype), intent(inout) :: obj
    !
    print *, "Hello World"
  end subroutine proc1
  !----------------------------------------------------------------------------
end module rk_mod

Hi,

Very sorry you have encountered this issue - thank you very much for reporting it to us. I have reported this to our developers as TPR#20948, and it is under investigation. We will follow up with more information as soon as it is available.

Best regards,

+chris

Correction, this is TPR#20945.

TPR 20945 - pgfortran -fast example ICE 'Errors in Lowering -

has been fixed in the current 15.1 release.

thanks,
dave