Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / masked_messages.cpp
blob31ed9af846e6bd373a59f316fe031b75fa714770
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 masked
8 argc = x; // expected-warning {{variable 'x' is uninitialized when used here}}
11 void yyy(int argc) {
12 int x; // expected-note {{initialize the variable 'x' to silence this warning}}
13 #pragma omp masked filter(1)
14 argc = x; // expected-warning {{variable 'x' is uninitialized when used here}}
17 int foo();
19 int main() {
20 #pragma omp masked
22 #pragma omp masked filter(1) filter(2) // expected-error {{directive '#pragma omp masked' cannot contain more than one 'filter' clause}}
24 int x,y,z;
25 #pragma omp masked filter(x) filter(y) filter(z) // expected-error 2 {{directive '#pragma omp masked' cannot contain more than one 'filter' clause}}
27 #pragma omp masked nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp masked'}}
28 #pragma omp masked unknown // expected-warning {{extra tokens at the end of '#pragma omp masked' are ignored}}
29 foo();
31 #pragma omp masked
32 } // expected-error {{expected statement}}
34 #pragma omp masked filter(2)
35 } // expected-error {{expected statement}}
36 #pragma omp for
37 for (int i = 0; i < 10; ++i) {
38 foo();
39 #pragma omp masked filter(1) // expected-error {{region cannot be closely nested inside 'for' region}}
40 foo();
42 #pragma omp sections
44 foo();
45 #pragma omp masked // expected-error {{region cannot be closely nested inside 'sections' region}}
46 foo();
48 #pragma omp single
49 for (int i = 0; i < 10; ++i) {
50 foo();
51 #pragma omp masked allocate(i) // expected-error {{region cannot be closely nested inside 'single' region}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp masked'}}
52 foo();
54 #pragma omp masked
55 for (int i = 0; i < 10; ++i) {
56 foo();
57 #pragma omp masked
58 foo();
60 #pragma omp for ordered
61 for (int i = 0; i < 10; ++i)
62 #pragma omp masked // expected-error {{region cannot be closely nested inside 'for' region}}
64 foo();
67 return 0;
70 int foo() {
71 L1: // expected-note {{jump exits scope of OpenMP structured block}}
72 foo();
73 #pragma omp masked filter(0)
75 foo();
76 goto L1; // expected-error {{cannot jump from this goto statement to its label}}
78 goto L2; // expected-error {{cannot jump from this goto statement to its label}}
79 #pragma omp masked filter(-2)
80 { // expected-note {{jump bypasses OpenMP structured block}}
81 L2:
82 foo();
85 return 0;