[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / omp-nested-distribute.f90
blob92a121659f2027d7b414ce21c12d4ad0e31f145e
1 ! RUN: %S/test_errors.sh %s %t %flang -fopenmp
2 ! REQUIRES: shell
3 ! Check OpenMP clause validity for the following directives:
4 ! 2.10 Device constructs
5 program main
7 real(8) :: arrayA(256), arrayB(256)
8 integer :: N
10 arrayA = 1.414
11 arrayB = 3.14
12 N = 256
14 !$omp task
15 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
16 !$omp distribute
17 do i = 1, N
18 a = 3.14
19 enddo
20 !$omp end distribute
21 !$omp end task
23 !$omp teams
24 do i = 1, N
25 !ERROR: Only `DISTRIBUTE` or `PARALLEL` regions are allowed to be strictly nested inside `TEAMS` region.
26 !$omp task
27 do k = 1, N
28 a = 3.14
29 enddo
30 !$omp end task
31 enddo
32 !$omp end teams
34 !$omp teams
35 do i = 1, N
36 !$omp parallel
37 do k = 1, N
38 a = 3.14
39 enddo
40 !$omp end parallel
41 enddo
42 !$omp end teams
44 !$omp parallel
45 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
46 !$omp distribute
47 do i = 1, N
48 a = 3.14
49 enddo
50 !$omp end distribute
51 !$omp end parallel
53 !$omp teams
54 !ERROR: Only `DISTRIBUTE` or `PARALLEL` regions are allowed to be strictly nested inside `TEAMS` region.
55 !$omp target
56 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
57 !$omp distribute
58 do i = 1, 10
59 j = j + 1
60 end do
61 !$omp end distribute
62 !$omp end target
63 !$omp end teams
65 !$omp teams
66 !$omp parallel
67 do k = 1,10
68 print *, "hello"
69 end do
70 !$omp end parallel
71 !$omp distribute firstprivate(a)
72 do i = 1, 10
73 j = j + 1
74 end do
75 !$omp end distribute
76 !$omp end teams
78 !$omp teams
79 !ERROR: Only `DISTRIBUTE` or `PARALLEL` regions are allowed to be strictly nested inside `TEAMS` region.
80 !$omp task
81 do k = 1,10
82 print *, "hello"
83 end do
84 !$omp end task
85 !$omp distribute firstprivate(a)
86 do i = 1, 10
87 j = j + 1
88 end do
89 !$omp end distribute
90 !$omp end teams
92 !$omp task
93 !$omp parallel
94 do k = 1,10
95 print *, "hello"
96 end do
97 !$omp end parallel
98 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
99 !$omp distribute firstprivate(a)
100 do i = 1, 10
101 j = j + 1
102 end do
103 !$omp end distribute
104 !$omp end task
105 end program main