Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / master_messages.cpp
blobd4f35597be4af6957de391fd31b793f7977d2dcc
1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
5 void xxx(int argc) {
6 int x; // expected-note {{initialize the variable 'x' to silence this warning}}
7 #pragma omp master
8 argc = x; // expected-warning {{variable 'x' is uninitialized when used here}}
11 int foo();
13 int main() {
14 #pragma omp master
16 #pragma omp master nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp master'}}
17 #pragma omp master unknown // expected-warning {{extra tokens at the end of '#pragma omp master' are ignored}}
18 foo();
20 #pragma omp master
21 } // expected-error {{expected statement}}
22 #pragma omp for
23 for (int i = 0; i < 10; ++i) {
24 foo();
25 #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}}
26 foo();
28 #pragma omp sections
30 foo();
31 #pragma omp master // expected-error {{region cannot be closely nested inside 'sections' region}}
32 foo();
34 #pragma omp single
35 for (int i = 0; i < 10; ++i) {
36 foo();
37 #pragma omp master allocate(i) // expected-error {{region cannot be closely nested inside 'single' region}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp master'}}
38 foo();
40 #pragma omp master
41 for (int i = 0; i < 10; ++i) {
42 foo();
43 #pragma omp master
44 foo();
46 #pragma omp for ordered
47 for (int i = 0; i < 10; ++i)
48 #pragma omp master // expected-error {{region cannot be closely nested inside 'for' region}}
50 foo();
53 return 0;
56 int foo() {
57 L1: // expected-note {{jump exits scope of OpenMP structured block}}
58 foo();
59 #pragma omp master
61 foo();
62 goto L1; // expected-error {{cannot jump from this goto statement to its label}}
64 goto L2; // expected-error {{cannot jump from this goto statement to its label}}
65 #pragma omp master
66 { // expected-note {{jump bypasses OpenMP structured block}}
67 L2:
68 foo();
71 return 0;