[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / OpenACC / acc-serial-loop.f90
blobb0e04dd25a80069641a242fe229981ae89fd9c91
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
3 ! Check OpenACC clause validity for the following construct and directive:
4 ! 2.11 Serial Loop
6 program openacc_serial_loop_validity
8 implicit none
10 integer :: i, b
11 integer, parameter :: N = 256
12 integer, dimension(N) :: c
13 logical, dimension(N) :: d, e
14 integer :: async1
15 integer :: wait1, wait2
16 real :: reduction_r
17 logical :: reduction_l
18 logical :: ifCondition = .TRUE.
19 real(8), dimension(N) :: a
22 !$acc serial loop reduction(+: reduction_r)
23 do i = 1, N
24 reduction_r = a(i) + i
25 end do
27 !$acc serial loop reduction(*: reduction_r)
28 do i = 1, N
29 reduction_r = reduction_r * (a(i) + i)
30 end do
32 !$acc serial loop reduction(min: reduction_r)
33 do i = 1, N
34 reduction_r = min(reduction_r, a(i) * i)
35 end do
37 !$acc serial loop reduction(max: reduction_r)
38 do i = 1, N
39 reduction_r = max(reduction_r, a(i) * i)
40 end do
42 !$acc serial loop reduction(iand: b)
43 do i = 1, N
44 b = iand(b, c(i))
45 end do
47 !$acc serial loop reduction(ior: b)
48 do i = 1, N
49 b = ior(b, c(i))
50 end do
52 !$acc serial loop reduction(ieor: b)
53 do i = 1, N
54 b = ieor(b, c(i))
55 end do
57 !$acc serial loop reduction(.and.: reduction_l)
58 do i = 1, N
59 reduction_l = d(i) .and. e(i)
60 end do
62 !$acc serial loop reduction(.or.: reduction_l)
63 do i = 1, N
64 reduction_l = d(i) .or. e(i)
65 end do
67 !$acc serial loop reduction(.eqv.: reduction_l)
68 do i = 1, N
69 reduction_l = d(i) .eqv. e(i)
70 end do
72 !$acc serial loop reduction(.neqv.: reduction_l)
73 do i = 1, N
74 reduction_l = d(i) .neqv. e(i)
75 end do
77 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the SERIAL LOOP directive
78 !$acc serial loop device_type(*) if(.TRUE.)
79 do i = 1, N
80 a(i) = 3.14
81 end do
82 !$acc end serial loop
84 !$acc serial loop if(ifCondition)
85 do i = 1, N
86 a(i) = 3.14
87 end do
88 !$acc end serial loop
90 !$acc serial loop
91 do i = 1, N
92 a(i) = 3.14
93 end do
94 !ERROR: Unmatched END PARALLEL LOOP directive
95 !$acc end parallel loop
97 end program openacc_serial_loop_validity