[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / OpenACC / acc-init-validity.f90
blob2b2eac51535d25e833c5bcd8881fe629a89c50fc
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.1 Init
7 program openacc_init_validity
9 implicit none
11 integer :: i, j
12 integer, parameter :: N = 256
13 logical :: ifCondition = .TRUE.
14 real(8), dimension(N) :: a
16 !$acc init
17 !$acc init if(.TRUE.)
18 !$acc init if(ifCondition)
19 !$acc init device_num(1)
20 !$acc init device_num(i)
21 !$acc init device_type(i)
22 !$acc init device_type(2, i, j)
23 !$acc init device_num(i) device_type(i, j) if(ifCondition)
25 !$acc parallel
26 !ERROR: Directive INIT may not be called within a compute region
27 !$acc init
28 !$acc end parallel
30 !$acc serial
31 !ERROR: Directive INIT may not be called within a compute region
32 !$acc init
33 !$acc end serial
35 !$acc kernels
36 !ERROR: Directive INIT may not be called within a compute region
37 !$acc init
38 !$acc end kernels
40 !$acc parallel
41 !$acc loop
42 do i = 1, N
43 !ERROR: Directive INIT may not be called within a compute region
44 !$acc init
45 a(i) = 3.14
46 end do
47 !$acc end parallel
49 !$acc serial
50 !$acc loop
51 do i = 1, N
52 !ERROR: Directive INIT may not be called within a compute region
53 !$acc init
54 a(i) = 3.14
55 end do
56 !$acc end serial
58 !$acc kernels
59 !$acc loop
60 do i = 1, N
61 !ERROR: Directive INIT may not be called within a compute region
62 !$acc init
63 a(i) = 3.14
64 end do
65 !$acc end kernels
67 !$acc parallel loop
68 do i = 1, N
69 !ERROR: Directive INIT may not be called within a compute region
70 !$acc init
71 a(i) = 3.14
72 end do
74 !$acc serial loop
75 do i = 1, N
76 !ERROR: Directive INIT may not be called within a compute region
77 !$acc init
78 a(i) = 3.14
79 end do
81 !$acc kernels loop
82 do i = 1, N
83 !ERROR: Directive INIT may not be called within a compute region
84 !$acc init
85 a(i) = 3.14
86 end do
88 !ERROR: At most one IF clause can appear on the INIT directive
89 !$acc init if(.TRUE.) if(ifCondition)
91 !ERROR: At most one DEVICE_NUM clause can appear on the INIT directive
92 !$acc init device_num(1) device_num(i)
94 !ERROR: At most one DEVICE_TYPE clause can appear on the INIT directive
95 !$acc init device_type(2) device_type(i, j)
97 end program openacc_init_validity