[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / OpenACC / acc-set-validity.f90
blob4bc342e2f38b535202c2dad22e9ca1cff843358c
1 ! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
2 ! REQUIRES: shell
4 ! Check OpenACC clause validity for the following construct and directive:
5 ! 2.14.3 Set
7 program openacc_clause_validity
9 implicit none
11 integer :: i, j
12 integer, parameter :: N = 256
13 real(8), dimension(N) :: a
15 !$acc parallel
16 !ERROR: Directive SET may not be called within a compute region
17 !$acc set default_async(i)
18 !$acc end parallel
20 !$acc serial
21 !ERROR: Directive SET may not be called within a compute region
22 !$acc set default_async(i)
23 !$acc end serial
25 !$acc kernels
26 !ERROR: Directive SET may not be called within a compute region
27 !$acc set default_async(i)
28 !$acc end kernels
30 !$acc parallel
31 !$acc loop
32 do i = 1, N
33 !ERROR: Directive SET may not be called within a compute region
34 !$acc set default_async(i)
35 a(i) = 3.14
36 end do
37 !$acc end parallel
39 !$acc serial
40 !$acc loop
41 do i = 1, N
42 !ERROR: Directive SET may not be called within a compute region
43 !$acc set default_async(i)
44 a(i) = 3.14
45 end do
46 !$acc end serial
48 !$acc kernels
49 !$acc loop
50 do i = 1, N
51 !ERROR: Directive SET may not be called within a compute region
52 !$acc set default_async(i)
53 a(i) = 3.14
54 end do
55 !$acc end kernels
57 !$acc parallel loop
58 do i = 1, N
59 !ERROR: Directive SET may not be called within a compute region
60 !$acc set default_async(i)
61 a(i) = 3.14
62 end do
64 !$acc serial loop
65 do i = 1, N
66 !ERROR: Directive SET may not be called within a compute region
67 !$acc set default_async(i)
68 a(i) = 3.14
69 end do
71 !$acc kernels loop
72 do i = 1, N
73 !ERROR: Directive SET may not be called within a compute region
74 !$acc set default_async(i)
75 a(i) = 3.14
76 end do
78 !ERROR: At least one of DEFAULT_ASYNC, DEVICE_NUM, DEVICE_TYPE clause must appear on the SET directive
79 !$acc set
81 !ERROR: At least one of DEFAULT_ASYNC, DEVICE_NUM, DEVICE_TYPE clause must appear on the SET directive
82 !$acc set if(.TRUE.)
84 !ERROR: At most one DEFAULT_ASYNC clause can appear on the SET directive
85 !$acc set default_async(2) default_async(1)
87 !ERROR: At most one DEFAULT_ASYNC clause can appear on the SET directive
88 !$acc set default_async(2) default_async(1)
90 !ERROR: At most one DEVICE_NUM clause can appear on the SET directive
91 !$acc set device_num(1) device_num(i)
93 !ERROR: At most one DEVICE_TYPE clause can appear on the SET directive
94 !$acc set device_type(i) device_type(2, i, j)
96 !$acc set default_async(2)
97 !$acc set default_async(i)
98 !$acc set device_num(1)
99 !$acc set device_num(i)
100 !$acc set device_type(i)
101 !$acc set device_type(2, i, j)
102 !$acc set device_num(1) default_async(2) device_type(2, i, j)
104 !ERROR: At least one of DEFAULT_ASYNC, DEVICE_NUM, DEVICE_TYPE clause must appear on the SET directive
105 !$acc set
107 end program openacc_clause_validity