[clangd] Re-land "support outgoing calls in call hierarchy" (#117673)
[llvm-project.git] / flang / test / Semantics / OpenMP / nested-distribute.f90
blobc212763cba1df86f916bbf6788f7266d167978f7
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2 ! Check OpenMP clause validity for the following directives:
3 ! 2.10 Device constructs
4 program main
6 real(8) :: arrayA(256), arrayB(256)
7 integer :: N
9 arrayA = 1.414
10 arrayB = 3.14
11 N = 256
13 !$omp task
14 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
15 !$omp distribute
16 do i = 1, N
17 a = 3.14
18 enddo
19 !$omp end distribute
20 !$omp end task
22 !$omp teams
23 do i = 1, N
24 !ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.
25 !$omp task
26 do k = 1, N
27 a = 3.14
28 enddo
29 !$omp end task
30 enddo
31 !$omp end teams
33 !$omp teams
34 do i = 1, N
35 !$omp parallel
36 do k = 1, N
37 a = 3.14
38 enddo
39 !$omp end parallel
40 enddo
41 !$omp end teams
43 !$omp parallel
44 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
45 !$omp distribute
46 do i = 1, N
47 a = 3.14
48 enddo
49 !$omp end distribute
50 !$omp end parallel
52 !$omp teams
53 !ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.
54 !$omp target
55 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
56 !$omp distribute
57 do i = 1, 10
58 j = j + 1
59 end do
60 !$omp end distribute
61 !$omp end target
62 !$omp end teams
64 !$omp teams
65 !$omp parallel
66 do k = 1,10
67 print *, "hello"
68 end do
69 !$omp end parallel
70 !$omp distribute firstprivate(a)
71 do i = 1, 10
72 j = j + 1
73 end do
74 !$omp end distribute
75 !$omp end teams
77 !$omp target teams
78 !$omp distribute
79 do i = 1, 10
80 end do
81 !$omp end distribute
82 !$omp end target teams
84 !$omp teams
85 !ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.
86 !$omp task
87 do k = 1,10
88 print *, "hello"
89 end do
90 !$omp end task
91 !$omp distribute firstprivate(a)
92 do i = 1, 10
93 j = j + 1
94 end do
95 !$omp end distribute
96 !$omp end teams
98 !$omp task
99 !$omp parallel
100 do k = 1,10
101 print *, "hello"
102 end do
103 !$omp end parallel
104 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
105 !$omp distribute firstprivate(a)
106 do i = 1, 10
107 j = j + 1
108 end do
109 !$omp end distribute
110 !$omp end task
111 end program main