[clang-format][NFC] Add a TypeScript test case
[llvm-project.git] / flang / test / Semantics / OpenACC / acc-set-validity.f90
blob74522b30d11bc4950ab385416e8d8ab2e5ba416c
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
3 ! Check OpenACC clause validity for the following construct and directive:
4 ! 2.14.3 Set
6 program openacc_clause_validity
8 implicit none
10 integer :: i, j
11 integer, parameter :: N = 256
12 real(8), dimension(N) :: a
14 !$acc parallel
15 !ERROR: Directive SET may not be called within a compute region
16 !$acc set default_async(i)
17 !$acc end parallel
19 !$acc serial
20 !ERROR: Directive SET may not be called within a compute region
21 !$acc set default_async(i)
22 !$acc end serial
24 !$acc kernels
25 !ERROR: Directive SET may not be called within a compute region
26 !$acc set default_async(i)
27 !$acc end kernels
29 !$acc parallel
30 !$acc loop
31 do i = 1, N
32 !ERROR: Directive SET may not be called within a compute region
33 !$acc set default_async(i)
34 a(i) = 3.14
35 end do
36 !$acc end parallel
38 !$acc serial
39 !$acc loop
40 do i = 1, N
41 !ERROR: Directive SET may not be called within a compute region
42 !$acc set default_async(i)
43 a(i) = 3.14
44 end do
45 !$acc end serial
47 !$acc kernels
48 !$acc loop
49 do i = 1, N
50 !ERROR: Directive SET may not be called within a compute region
51 !$acc set default_async(i)
52 a(i) = 3.14
53 end do
54 !$acc end kernels
56 !$acc parallel loop
57 do i = 1, N
58 !ERROR: Directive SET may not be called within a compute region
59 !$acc set default_async(i)
60 a(i) = 3.14
61 end do
63 !$acc serial loop
64 do i = 1, N
65 !ERROR: Directive SET may not be called within a compute region
66 !$acc set default_async(i)
67 a(i) = 3.14
68 end do
70 !$acc kernels loop
71 do i = 1, N
72 !ERROR: Directive SET may not be called within a compute region
73 !$acc set default_async(i)
74 a(i) = 3.14
75 end do
77 !ERROR: At least one of DEFAULT_ASYNC, DEVICE_NUM, DEVICE_TYPE clause must appear on the SET directive
78 !$acc set
80 !ERROR: At least one of DEFAULT_ASYNC, DEVICE_NUM, DEVICE_TYPE clause must appear on the SET directive
81 !$acc set if(.TRUE.)
83 !ERROR: At most one DEFAULT_ASYNC clause can appear on the SET directive
84 !$acc set default_async(2) default_async(1)
86 !ERROR: At most one DEFAULT_ASYNC clause can appear on the SET directive
87 !$acc set default_async(2) default_async(1)
89 !ERROR: At most one DEVICE_NUM clause can appear on the SET directive
90 !$acc set device_num(1) device_num(i)
92 !ERROR: At most one DEVICE_TYPE clause can appear on the SET directive
93 !$acc set device_type(*) device_type(nvidia)
95 !$acc set default_async(2)
96 !$acc set default_async(i)
97 !$acc set device_num(1)
98 !$acc set device_num(i)
99 !$acc set device_type(default)
100 !$acc set device_num(1) default_async(2) device_type(*)
102 !ERROR: The DEVICE_TYPE clause on the SET directive accepts only one value
103 !$acc set device_type(*, default)
105 !ERROR: At least one of DEFAULT_ASYNC, DEVICE_NUM, DEVICE_TYPE clause must appear on the SET directive
106 !$acc set
108 end program openacc_clause_validity