[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / OpenACC / acc-parallel-loop-validity.f90
blob312baacbc00a87e89e77c12692f222e998d584cb
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
3 ! Check OpenACC clause validity for the following construct and directive:
4 ! 2.11 Parallel Loop
6 program openacc_parallel_loop_validity
8 implicit none
10 integer :: i, j, b
11 integer, parameter :: N = 256
12 integer, dimension(N) :: c
13 logical, dimension(N) :: d, e
14 real :: reduction_r
15 logical :: reduction_l
16 logical :: ifCondition = .TRUE.
17 real(8), dimension(N) :: a, f, g, h
18 real(8), dimension(N, N) :: aa, bb, cc
20 !$acc parallel loop tile(2)
21 do i = 1, N
22 a(i) = 3.14
23 end do
25 !$acc parallel loop self
26 do i = 1, N
27 a(i) = 3.14
28 end do
30 !ERROR: SELF clause on the PARALLEL LOOP directive only accepts optional scalar logical expression
31 !$acc parallel loop self(bb, cc(:))
32 do i = 1, N
33 a(i) = 3.14
34 end do
36 !$acc parallel loop self(.true.)
37 do i = 1, N
38 a(i) = 3.14
39 end do
41 !$acc parallel loop self(ifCondition)
42 do i = 1, N
43 a(i) = 3.14
44 end do
46 !$acc parallel loop tile(2, 2)
47 do i = 1, N
48 do j = 1, N
49 aa(i, j) = 3.14
50 end do
51 end do
53 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL LOOP directive
54 !$acc parallel loop device_type(*) if(.TRUE.)
55 do i = 1, N
56 a(i) = 3.14
57 end do
58 !$acc end parallel loop
60 !$acc kernels loop
61 do i = 1, N
62 a(i) = 3.14
63 end do
64 !ERROR: Unmatched END PARALLEL LOOP directive
65 !$acc end parallel loop
67 !$acc parallel loop reduction(+: reduction_r)
68 do i = 1, N
69 reduction_r = a(i) + i
70 end do
72 !$acc parallel loop reduction(*: reduction_r)
73 do i = 1, N
74 reduction_r = reduction_r * (a(i) + i)
75 end do
77 !$acc parallel loop reduction(min: reduction_r)
78 do i = 1, N
79 reduction_r = min(reduction_r, a(i) * i)
80 end do
82 !$acc parallel loop reduction(max: reduction_r)
83 do i = 1, N
84 reduction_r = max(reduction_r, a(i) * i)
85 end do
87 !$acc parallel loop reduction(iand: b)
88 do i = 1, N
89 b = iand(b, c(i))
90 end do
92 !$acc parallel loop reduction(ior: b)
93 do i = 1, N
94 b = ior(b, c(i))
95 end do
97 !$acc parallel loop reduction(ieor: b)
98 do i = 1, N
99 b = ieor(b, c(i))
100 end do
102 !$acc parallel loop reduction(.and.: reduction_l)
103 do i = 1, N
104 reduction_l = d(i) .and. e(i)
105 end do
107 !$acc parallel loop reduction(.or.: reduction_l)
108 do i = 1, N
109 reduction_l = d(i) .or. e(i)
110 end do
112 !$acc parallel loop reduction(.eqv.: reduction_l)
113 do i = 1, N
114 reduction_l = d(i) .eqv. e(i)
115 end do
117 !$acc parallel loop reduction(.neqv.: reduction_l)
118 do i = 1, N
119 reduction_l = d(i) .neqv. e(i)
120 end do
122 end program openacc_parallel_loop_validity