Issue 165055
Summary [flang] Runtime error of `Invalid descriptor` when deallocate an allocated pointer.
Labels flang:fir-hlfir
Assignees
Reporter DanielCChen
    Consider the following code:
```
module m
    type base
        private
 integer*4 :: id
    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

module m1
use m
    type container
 !class (base), pointer :: data ="" null()   !! REG: passed without PR #164279
        type(base), pointer :: data ="" null()      !! Always fail with or without 164279
    end type
end module

program fpAssgn016
use m1
    type (container) :: co1(10)

    forall (i=1:10)
 co1(i)%data ="" makeData (i)
    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:37): 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. 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to