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

Kareem Ergawy via flang-commits flang-commits at lists.llvm.org
Wed Sep 16 01:39:41 PDT 2026


ergawy wrote:

> On question, under `-gpu=mem:managed` this makes every allocatable component MANAGED, which I think trips the DEVICE-object check in `check-allocate.cpp`. Can you check whether this fails with your fix?
> 
> ```fortran
> module m
>   type :: t
>     real, allocatable :: a(:)
>   end type
> end module
> 
> subroutine s()
>   use m
>   type(t), device :: d
>   allocate(d%a(10))
>   deallocate(d%a)
> end subroutine
> ```
> 
> It compiles today with and without the flag, and the reference compiler accepts it too. If it does start failing, the message would name MANAGED on a component the user never attributed.

Thanks Zhen, very good catch. It indeed now reports a semantic error. I am looking into it.

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


More information about the flang-commits mailing list