Consider the following code:
module m
type base
integer :: id
end type
type container
!class (base), pointer :: data => null()
type(base), pointer :: data => null()
end type
contains
pure function makeData (i)
type (base), pointer :: makeData
integer*4, intent(in) :: i
allocate (makeData)
makeData = base(i)
end function
end module
program fpAssgn016
use m
type (container) :: co1(10)
forall (i=1:10)
! do i = 1,10 !! work around
co1(i)%data => makeData (i)
! end do
end forall
do i =1, 10
deallocate (co1(i)%data)
end do
end
Flang failed at the runtime as
> a.out
fatal Fortran runtime error(t.f:36): Invalid descriptor
Abort(coredump)
This failure seems a regression after the merge of PR #164279. However, if I changed the LHS to be NOT polymorphic, it still fails the same.
It seems the "allocatable" property got lost through the pointer assignment in FORALL.