xref: /llvm-project/flang/test/Semantics/cuf13.cuf (revision b9541f9879b7c43d796e78e32ac896dd05550d71)
1! RUN: %flang_fc1 -x cuda -fdebug-unparse %s | FileCheck %s
2
3module matching
4  interface sub
5    module procedure sub_host
6    module procedure sub_device
7    module procedure sub_managed
8    module procedure sub_unified
9  end interface
10
11contains
12  subroutine sub_host(a)
13    integer :: a(:)
14  end
15
16  subroutine sub_device(a)
17    integer, device :: a(:)
18  end
19
20  subroutine sub_managed(a)
21    integer, managed :: a(:)
22  end
23
24  subroutine sub_unified(a)
25    integer, unified :: a(:)
26  end
27end module
28
29program m
30  use matching
31
32  integer, pinned, allocatable :: a(:)
33  integer, managed, allocatable :: b(:)
34  integer, unified, allocatable :: u(:)
35  integer, device :: d(10)
36  logical :: plog
37  allocate(a(100), pinned = plog)
38  allocate(b(200))
39  allocate(u(100))
40
41  call sub(a) ! Should resolve to sub_host
42  call sub(b) ! Should resolve to sub_managed
43  call sub(u) ! Should resolve to sub_unified
44  call sub(d) ! Should resolve to sub_device
45
46end
47
48! CHECK: CALL sub_host
49! CHECK: CALL sub_managed
50! CHECK: CALL sub_unified
51! CHECK: CALL sub_device
52