Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / nested-distribute.f90
blob5103790392897d5d29a7eb2fc1ec3007151751a0
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` or `PARALLEL` 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` or `PARALLEL` 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 teams
78 !ERROR: Only `DISTRIBUTE` or `PARALLEL` regions are allowed to be strictly nested inside `TEAMS` region.
79 !$omp task
80 do k = 1,10
81 print *, "hello"
82 end do
83 !$omp end task
84 !$omp distribute firstprivate(a)
85 do i = 1, 10
86 j = j + 1
87 end do
88 !$omp end distribute
89 !$omp end teams
91 !$omp task
92 !$omp parallel
93 do k = 1,10
94 print *, "hello"
95 end do
96 !$omp end parallel
97 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
98 !$omp distribute firstprivate(a)
99 do i = 1, 10
100 j = j + 1
101 end do
102 !$omp end distribute
103 !$omp end task
104 end program main