[LLVM] Fix Maintainers.md formatting (NFC)
[llvm-project.git] / flang / test / Semantics / OpenMP / nested-teams.f90
blobb1a7c92a6906b4ff5642bed66e7b36bbade1e000
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
3 ! OpenMP Version 5.0
4 ! Check OpenMP construct validity for the following directives:
5 ! 2.7 Teams Construct
7 program main
8 integer :: i, j, N = 10
9 real :: a, b, c
11 !$omp teams
12 a = 3.14
13 !$omp end teams
15 !$omp target
16 !$omp teams
17 a = 3.14
18 !$omp end teams
19 !$omp end target
21 !$omp target
22 !$omp parallel
23 !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
24 !$omp teams
25 a = 3.14
26 !$omp end teams
27 !$omp end parallel
28 !$omp end target
30 !$omp parallel
31 !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
32 !$omp teams
33 a = 3.14
34 !$omp end teams
35 !$omp end parallel
37 !$omp do
38 do i = 1, N
39 !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
40 !$omp teams
41 a = 3.14
42 !$omp end teams
43 end do
45 !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead.
46 !$omp master
47 !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
48 !$omp teams
49 a = 3.14
50 !$omp end teams
51 !$omp end master
53 !$omp target parallel
54 !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
55 !$omp teams
56 a = 3.14
57 !$omp end teams
58 !$omp end target parallel
60 !$omp target
61 !$omp teams
62 !ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.
63 !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
64 !$omp teams
65 a = 3.14
66 !$omp end teams
67 !$omp end teams
68 !$omp end target
70 !$omp target teams
71 !ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
72 !$omp teams
73 a = 3.14
74 !$omp end teams
75 !$omp end target teams
77 !ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
78 !$omp target
79 do i = 1, N
80 !$omp teams
81 a = 3.14
82 !$omp end teams
83 enddo
84 !$omp end target
86 !ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
87 !$omp target
88 if (i .GT. 1) then
89 if (j .GT. 1) then
90 !$omp teams
91 a = 3.14
92 !$omp end teams
93 end if
94 end if
95 !$omp end target
97 !ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
98 !$omp target
99 b = 3.14
100 !$omp teams
101 a = 3.14
102 !$omp end teams
103 !$omp end target
105 !ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
106 !$omp target
107 !$omp teams
108 a = 3.14
109 !$omp end teams
110 c = 3.14
111 !$omp end target
113 end program main