[clangd] Re-land "support outgoing calls in call hierarchy" (#117673)
[llvm-project.git] / flang / test / Semantics / OpenMP / reduction-modifiers.f90
blobe6238bb8cb7ffcb297241fefb0003270d5733fa9
1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=52
3 subroutine mod_task1(x)
4 integer, intent(inout) :: x
6 !Correct: "parallel" directive.
7 !$omp parallel reduction(task, +:x)
8 do i = 1, 100
9 x = foo(i)
10 enddo
11 !$omp end parallel
12 end
14 subroutine mod_task2(x)
15 integer, intent(inout) :: x
17 !Correct: worksharing directive.
18 !$omp sections reduction(task, +:x)
19 do i = 1, 100
20 x = foo(i)
21 enddo
22 !$omp end sections
23 end
25 subroutine mod_task3(x)
26 integer, intent(inout) :: x
28 !ERROR: Modifier 'TASK' on REDUCTION clause is only allowed with PARALLEL or worksharing directive
29 !$omp simd reduction(task, +:x)
30 do i = 1, 100
31 x = foo(i)
32 enddo
33 !$omp end simd
34 end
36 subroutine mod_inscan1(x)
37 integer, intent(inout) :: x
39 !Correct: worksharing-loop directive
40 !$omp do reduction(inscan, +:x)
41 do i = 1, 100
42 !$omp scan inclusive(x)
43 x = foo(i)
44 enddo
45 !$omp end do
46 end
48 subroutine mod_inscan2(x)
49 integer, intent(inout) :: x
51 !Correct: worksharing-loop simd directive
52 !$omp do simd reduction(inscan, +:x)
53 do i = 1, 100
54 !$omp scan inclusive(x)
55 x = foo(i)
56 enddo
57 !$omp end do simd
58 end
60 subroutine mod_inscan3(x)
61 integer, intent(inout) :: x
63 !Correct: "simd" directive
64 !$omp simd reduction(inscan, +:x)
65 do i = 1, 100
66 !$omp scan inclusive(x)
67 x = foo(i)
68 enddo
69 !$omp end simd
70 end
72 subroutine mod_inscan4(x)
73 integer, intent(inout) :: x
75 !ERROR: Modifier 'INSCAN' on REDUCTION clause is only allowed with WORKSHARING LOOP, WORKSHARING LOOP SIMD, or SIMD directive
76 !$omp parallel reduction(inscan, +:x)
77 do i = 1, 100
78 x = foo(i)
79 enddo
80 !$omp end parallel
81 end
83 subroutine mod_inscan5(x)
84 integer, intent(inout) :: x
86 !ERROR: Modifier 'INSCAN' on REDUCTION clause is only allowed with WORKSHARING LOOP, WORKSHARING LOOP SIMD, or SIMD directive
87 !$omp sections reduction(inscan, +:x)
88 do i = 1, 100
89 x = foo(i)
90 enddo
91 !$omp end sections
92 end