1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 %s -Wuninitialized 2 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 %s -Wuninitialized 3 xxx(int argc)4void xxx(int argc) { 5 int x; // expected-note {{initialize the variable 'x' to silence this warning}} 6 [[omp::directive(masked)]] 7 argc = x; // expected-warning {{variable 'x' is uninitialized when used here}} 8 } 9 yyy(int argc)10void yyy(int argc) { 11 int x; // expected-note {{initialize the variable 'x' to silence this warning}} 12 [[omp::directive(masked filter(1))]] 13 argc = x; // expected-warning {{variable 'x' is uninitialized when used here}} 14 } 15 16 int foo(); 17 main()18int main() { 19 [[omp::directive(masked)]] 20 ; 21 [[omp::directive(masked filter(1) filter(2))]] // expected-error {{directive '#pragma omp masked' cannot contain more than one 'filter' clause}} 22 ; 23 int x,y,z; 24 [[omp::directive(masked filter(x) filter(y) filter(z))]] // expected-error 2 {{directive '#pragma omp masked' cannot contain more than one 'filter' clause}} 25 ; 26 [[omp::directive(masked nowait)]] // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp masked'}} 27 [[omp::directive(masked unknown)]] // expected-warning {{extra tokens at the end of '#pragma omp masked' are ignored}} 28 foo(); 29 { 30 [[omp::directive(masked)]] 31 } // expected-error {{expected statement}} 32 { 33 [[omp::directive(masked filter(2))]] 34 } // expected-error {{expected statement}} 35 [[omp::directive(for)]] 36 for (int i = 0; i < 10; ++i) { 37 foo(); 38 [[omp::directive(masked filter(1))]] // expected-error {{region cannot be closely nested inside 'for' region}} 39 foo(); 40 } 41 [[omp::directive(sections)]] 42 { 43 foo(); 44 [[omp::directive(masked)]] // expected-error {{region cannot be closely nested inside 'sections' region}} 45 foo(); 46 } 47 [[omp::directive(single)]] 48 for (int i = 0; i < 10; ++i) { 49 foo(); 50 [[omp::directive(masked allocate(i))]] // expected-error {{region cannot be closely nested inside 'single' region}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp masked'}} 51 foo(); 52 } 53 [[omp::directive(masked)]] 54 for (int i = 0; i < 10; ++i) { 55 foo(); 56 [[omp::directive(masked)]] 57 foo(); 58 } 59 [[omp::directive(for ordered)]] 60 for (int i = 0; i < 10; ++i) 61 [[omp::directive(masked)]] // expected-error {{region cannot be closely nested inside 'for' region}} 62 { 63 foo(); 64 } 65 66 return 0; 67 } 68 foo()69int foo() { 70 L1: // expected-note {{jump exits scope of OpenMP structured block}} 71 foo(); 72 [[omp::directive(masked filter(0))]] 73 { 74 foo(); 75 goto L1; // expected-error {{cannot jump from this goto statement to its label}} 76 } 77 goto L2; // expected-error {{cannot jump from this goto statement to its label}} 78 [[omp::directive(masked filter(-2))]] 79 { // expected-note {{jump bypasses OpenMP structured block}} 80 L2: 81 foo(); 82 } 83 84 return 0; 85 } 86 87