[flang-commits] [flang] [flang][cuda] Implicitly attribute ALLOCATABLE/POINTER components as managed (PR #223087)

Zhen Wang via flang-commits flang-commits at lists.llvm.org
Fri Sep 18 11:12:36 PDT 2026


wangzpgi wrote:

> > For this example under -gpu=managed:
> > ```fortran
> > module m
> >   type :: t
> >     real, allocatable :: a(:)
> >   end type
> > end module
> > 
> > subroutine s()
> >   use m
> >   type(t) :: obj        ! no CUDA attribute on obj itself
> >   allocate(obj%a(4))
> > end subroutine
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > is only obj%a managed, or is obj itself managed too? If obj is also managed, is that the intention? The reference compiler keeps obj as a normal host variable and only puts obj%a in managed memory.
> 
> The obj will be managed because the descriptor of a is in obj and needs to be managed.

Thanks for the explanation!

https://github.com/llvm/llvm-project/pull/223087


More information about the flang-commits mailing list