! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
! Test lowering of program local variables. Make sure CUDA device variables are
! not lowered as global.
program test
integer, device :: a(10)
integer, unified :: u(10)
integer, allocatable, pinned :: p(:)
integer :: b(10)
integer :: i
print*,i
end
! CHECK-LABEL: func.func @_QQmain()
! CHECK: cuf.alloc !fir.array<10xi32> {bindc_name = "a", data_attr = #cuf.cuda<device>, uniq_name = "_QFEa"} -> !fir.ref<!fir.array<10xi32>>
! CHECK: fir.address_of(@_QFEb) : !fir.ref<!fir.array<10xi32>>
! CHECK: %[[ALLOCA:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFEi"}
! CHECK: hlfir.declare %[[ALLOCA]] {uniq_name = "_QFEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: cuf.alloc !fir.box<!fir.heap<!fir.array<?xi32>>> {bindc_name = "p", data_attr = #cuf.cuda<pinned>, uniq_name = "_QFEp"} -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
! CHECK-NOT: fir.global internal @_QFEa {data_attr = #cuf.cuda<device>} : !fir.array<10xi32> {{{$}}
! CHECK: fir.global internal @_QFEb : !fir.array<10xi32> {{{$}}
! CHECK: fir.global internal @_QFEu {data_attr = #cuf.cuda<unified>} : !fir.array<10xi32>