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