xref: /llvm-project/flang/test/Semantics/OpenACC/acc-update-validity.f90 (revision f706837e2b85c7e5f29b118d0ecac41ba23e226f)
1! RUN: %python %S/../test_errors.py %s %flang -fopenacc
2
3! Check OpenACC clause validity for the following construct and directive:
4!   2.14.4 Update
5
6program openacc_update_validity
7
8  implicit none
9
10  type atype
11    real(8), dimension(10) :: arr
12  end type atype
13
14  integer :: i
15  integer, parameter :: N = 256
16  integer, dimension(N) :: c
17  integer :: async1
18  integer :: wait1, wait2
19  real(8), dimension(N, N) :: aa, bb, cc
20  logical :: ifCondition = .TRUE.
21  type(atype) :: t
22  type(atype), dimension(10) :: ta
23  real(8), dimension(N) :: a, f, g, h
24
25  !ERROR: At least one of DEVICE, HOST, SELF clause must appear on the UPDATE directive
26  !$acc update
27
28  !$acc update device(t%arr(:))
29
30  !$acc update device(ta(i)%arr(:))
31
32  !$acc update self(a, f) host(g) device(h)
33
34  !$acc update host(aa) async(1)
35
36  !$acc update device(bb) async(async1)
37
38  !ERROR: At most one ASYNC clause can appear on the UPDATE directive
39  !$acc update host(aa, bb) async(1) async(2)
40
41  !$acc update self(bb, cc(:,:)) wait(1)
42
43  !ERROR: SELF clause on the UPDATE directive must have a var-list
44  !$acc update self
45
46  !$acc update device(aa, bb, cc) wait(wait1)
47
48  !$acc update host(aa) host(bb) device(cc) wait(1,2)
49
50  !$acc update device(aa, cc) wait(wait1, wait2)
51
52  !$acc update device(aa) device_type(*) async
53
54  !$acc update host(bb) device_type(*) wait
55
56  !$acc update self(cc) device_type(host,multicore) async device_type(*) wait
57
58  !ERROR: At most one IF clause can appear on the UPDATE directive
59  !$acc update device(aa) if(.true.) if(ifCondition)
60
61  !ERROR: At most one IF_PRESENT clause can appear on the UPDATE directive
62  !$acc update device(bb) if_present if_present
63
64  !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the UPDATE directive
65  !$acc update device(i) device_type(*) if(.TRUE.)
66
67end program openacc_update_validity
68