[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / OpenMP / omp-reduction07.f90
bloba3b58765d9a6d56a9d05c03bca10f6290b7408ac
1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2 ! OpenMP Version 4.5
3 ! 2.15.3.6 Reduction Clause
4 program omp_reduction
6 integer :: a,i,j,l
7 integer :: k = 10
8 !$omp parallel private(k)
9 !ERROR: REDUCTION variable 'k' is PRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
10 !$omp do reduction(+:k)
11 do i = 1, 10
12 k = k + 1
13 end do
14 !$omp end do
15 !$omp end parallel
18 !$omp parallel private(j),reduction(+:k)
19 !ERROR: REDUCTION variable 'k' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
20 !$omp do reduction(+:k)
21 do i = 1, 10
22 k = k + 1
23 end do
24 !$omp end do
25 !$omp end parallel
27 !$omp parallel private(j),firstprivate(k)
28 !ERROR: REDUCTION variable 'k' is FIRSTPRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
29 !$omp do reduction(min:k)
30 do i = 1, 10
31 k = k + 1
32 end do
33 !$omp end do
34 !$omp end parallel
37 !$omp parallel private(l,j),firstprivate(k)
38 !ERROR: REDUCTION variable 'k' is FIRSTPRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
39 !ERROR: REDUCTION variable 'j' is PRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
40 !$omp sections reduction(ior:k) reduction(*:j)
41 do i = 1, 10
42 k = ior(k, 1)
43 j = j * 3
44 end do
45 !$omp end sections
46 !$omp end parallel
48 !$omp sections private(k)
49 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
50 !ERROR: REDUCTION variable 'k' is PRIVATE in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
51 !$omp do reduction(+:k) reduction(max:j)
52 do i = 1, 10
53 k = k + 1
54 end do
55 !$omp end do
56 !$omp end sections
58 !$omp sections private(k)
59 !$omp target
60 do j = 1,10
61 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
62 !$omp do reduction(+:k) reduction(max:j)
63 do i = 1, 10
64 k = k + 1
65 end do
66 !$omp end do
67 end do
68 !$omp end target
69 !$omp end sections
71 !$omp parallel reduction(+:a)
72 !ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
73 !$omp sections reduction(*:a)
74 a = a + 10
75 !$omp end sections
76 !$omp end parallel
78 !$omp parallel reduction(*:a)
79 !$omp end parallel
82 !$omp parallel reduction(+:a)
83 !ERROR: REDUCTION clause is not allowed on the WORKSHARE directive
84 !ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
85 !$omp workshare reduction(*:a)
86 a = a + 10
87 !$omp end workshare
88 !$omp end parallel
90 !$omp parallel reduction(*:a)
91 !$omp end parallel
94 !$omp parallel reduction(+:a)
95 !ERROR: REDUCTION clause is not allowed on the SINGLE directive
96 !ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
97 !$omp single reduction(*:a)
98 a = a + 10
99 !$omp end single
100 !$omp end parallel
102 !$omp parallel reduction(+:a)
103 !$omp end parallel
106 !$omp parallel reduction(+:a)
107 !ERROR: REDUCTION clause is not allowed on the SINGLE directive
108 !ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
109 !$omp single reduction(iand:a)
110 a = a + 10
111 !$omp end single
112 !$omp end parallel
114 !$omp parallel reduction(iand:a)
115 !$omp end parallel
117 !$omp parallel reduction(ieor:a)
118 !ERROR: REDUCTION variable 'a' is REDUCTION in outer context must be shared in the parallel regions to which any of the worksharing regions arising from the worksharing construct bind.
119 !$omp sections reduction(+:a)
120 a = ieor(a, 10)
121 !$omp end sections
122 !$omp end parallel
124 !$omp parallel reduction(ieor:a)
125 !$omp end parallel
127 end program omp_reduction