| 1 |
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized |
| 2 |
|
| 3 |
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized |
| 4 |
|
| 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}} |
| 9 |
} |
| 10 |
|
| 11 |
int foo(); |
| 12 |
|
| 13 |
int main() { |
| 14 |
#pragma omp master |
| 15 |
; |
| 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(); |
| 19 |
{ |
| 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(); |
| 27 |
} |
| 28 |
#pragma omp sections |
| 29 |
{ |
| 30 |
foo(); |
| 31 |
#pragma omp master // expected-error {{region cannot be closely nested inside 'sections' region}} |
| 32 |
foo(); |
| 33 |
} |
| 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(); |
| 39 |
} |
| 40 |
#pragma omp master |
| 41 |
for (int i = 0; i < 10; ++i) { |
| 42 |
foo(); |
| 43 |
#pragma omp master |
| 44 |
foo(); |
| 45 |
} |
| 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}} |
| 49 |
{ |
| 50 |
foo(); |
| 51 |
} |
| 52 |
|
| 53 |
return 0; |
| 54 |
} |
| 55 |
|
| 56 |
int foo() { |
| 57 |
L1: // expected-note {{jump exits scope of OpenMP structured block}} |
| 58 |
foo(); |
| 59 |
#pragma omp master |
| 60 |
{ |
| 61 |
foo(); |
| 62 |
goto L1; // expected-error {{cannot jump from this goto statement to its label}} |
| 63 |
} |
| 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(); |
| 69 |
} |
| 70 |
|
| 71 |
return 0; |
| 72 |
} |