1! { dg-do compile }
2! { dg-options "-fopenmp" }
3
4program main
5  integer :: x, i, n
6
7  x = 0
8  n = 10
9
10  !$omp parallel
11  block
12    call do_work
13  end block
14  call do_work
15  !$omp end parallel ! { dg-error "Unexpected !.OMP END PARALLEL statement" }
16
17  !$omp teams
18  block
19    call do_work
20  end block
21  call do_work
22  !$omp end teams ! { dg-error "Unexpected !.OMP END TEAMS statement" }
23
24  !$omp masked
25  block
26    x = x + 1
27  end block
28  x = x + 1
29  !$omp end masked ! { dg-error "Unexpected !.OMP END MASKED statement" }
30
31  !$omp scope
32  block
33    call do_work
34  end block
35  call do_work
36  !$omp end scope ! { dg-error "Unexpected !.OMP END SCOPE statement" }
37
38  !$omp single
39  block
40    x = x + 1
41  end block
42  x = x + 1
43  !$omp end single ! { dg-error "Unexpected !.OMP END SINGLE statement" }
44
45  !$omp workshare
46  block
47    x = x + 1
48  end block
49  x = x + 1
50  !$omp end workshare ! { dg-error "Unexpected !.OMP END WORKSHARE statement" }
51
52  !$omp task
53  block
54    call do_work
55  end block
56  call do_work
57  !$omp end task ! { dg-error "Unexpected !.OMP END TASK statement" }
58
59  !$omp target data map(x)
60  block
61    x = x + 1
62  end block
63  x = x + 1
64  !$omp end target data ! { dg-error "Unexpected !.OMP END TARGET DATA statement" }
65
66  !$omp target
67  block
68    x = x + 1
69  end block
70  x = x + 1
71  !$omp end target ! { dg-error "Unexpected !.OMP END TARGET statement" }
72
73  !$omp parallel workshare
74  block
75    x = x + 1
76  end block
77  x = x + 1
78  !$omp end parallel workshare ! { dg-error "Unexpected !.OMP END PARALLEL WORKSHARE statement" }
79
80  !$omp parallel masked
81  block
82    x = x + 1
83  end block
84  x = x + 1
85  !$omp end parallel masked ! { dg-error "Unexpected !.OMP END PARALLEL MASKED statement" }
86
87  !$omp target parallel
88  block
89    call do_work
90  end block
91  call do_work
92  !$omp end target parallel ! { dg-error "Unexpected !.OMP END TARGET PARALLEL statement" }
93
94  !$omp target teams
95  block
96    call do_work
97  end block
98  call do_work
99  !$omp end target teams ! { dg-error "Unexpected !.OMP END TARGET TEAMS statement" }
100
101  !$omp critical
102  block
103    x = x + 1
104  end block
105  x = x + 1
106  !$omp end critical ! { dg-error "Unexpected !.OMP END CRITICAL statement" }
107
108  !$omp taskgroup
109  block
110    x = x + 1
111  end block
112  x = x + 1
113  !$omp end taskgroup ! { dg-error "Unexpected !.OMP END TASKGROUP statement" }
114
115  !$omp do ordered
116  do i = 1, n
117     !$omp ordered
118     block
119       call do_work
120     end block
121     call do_work
122     !$omp end ordered ! { dg-error "Unexpected !.OMP END ORDERED statement" }
123  end do
124
125  !$omp master
126  block
127    x = x + 1
128  end block
129  x = x + 1
130  !$omp end master ! { dg-error "Unexpected !.OMP END MASTER statement" }
131
132  !$omp parallel master
133  block
134    x = x + 1
135  end block
136  x = x + 1
137  !$omp end parallel master ! { dg-error "Unexpected !.OMP END PARALLEL MASTER statement" }
138
139end program
140