Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_teams_distribute_simd_messages.cpp
blobcd3d38a2d48aa2fcf9395f6044bbb98193b31b5d
1 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized
5 void xxx(int argc) {
6 int x; // expected-note {{initialize the variable 'x' to silence this warning}}
7 #pragma omp target teams distribute simd
8 for (int i = 0; i < 10; ++i)
9 argc = x; // expected-warning {{variable 'x' is uninitialized when used here}}
12 void foo() {
15 static int pvt;
16 #pragma omp threadprivate(pvt)
18 #pragma omp target teams distribute simd // expected-error {{unexpected OpenMP directive '#pragma omp target teams distribute simd'}}
20 int main(int argc, char **argv) {
21 #pragma omp target teams distribute simd { // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute simd' are ignored}}
22 for (int i = 0; i < argc; ++i)
23 foo();
24 #pragma omp target teams distribute simd ( // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute simd' are ignored}}
25 for (int i = 0; i < argc; ++i)
26 foo();
27 #pragma omp target teams distribute simd[ // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute simd' are ignored}}
28 for (int i = 0; i < argc; ++i)
29 foo();
30 #pragma omp target teams distribute simd] // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute simd' are ignored}}
31 for (int i = 0; i < argc; ++i)
32 foo();
33 #pragma omp target teams distribute simd) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute simd' are ignored}}
34 for (int i = 0; i < argc; ++i)
35 foo();
36 #pragma omp target teams distribute simd } // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute simd' are ignored}}
37 for (int i = 0; i < argc; ++i)
38 foo();
39 #pragma omp target teams distribute simd
40 for (int i = 0; i < argc; ++i)
41 foo();
42 // expected-warning@+1 {{extra tokens at the end of '#pragma omp target teams distribute simd' are ignored}}
43 #pragma omp target teams distribute simd unknown()
44 for (int i = 0; i < argc; ++i)
45 foo();
46 L1:
47 for (int i = 0; i < argc; ++i)
48 foo();
49 #pragma omp target teams distribute simd
50 for (int i = 0; i < argc; ++i)
51 foo();
52 #pragma omp target teams distribute simd
53 for (int i = 0; i < argc; ++i) {
54 goto L1; // expected-error {{use of undeclared label 'L1'}}
55 argc++;
58 for (int i = 0; i < 10; ++i) {
59 switch (argc) {
60 case (0):
61 #pragma omp target teams distribute simd
62 for (int i = 0; i < argc; ++i) {
63 foo();
64 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
65 continue;
67 default:
68 break;
71 // expected-error@+1 {{unexpected OpenMP clause 'default' in directive '#pragma omp target teams distribute simd'}}
72 #pragma omp target teams distribute simd default(none)
73 for (int i = 0; i < 10; ++i)
74 ++argc;
76 goto L2; // expected-error {{use of undeclared label 'L2'}}
77 #pragma omp target teams distribute simd
78 for (int i = 0; i < argc; ++i)
79 L2:
80 foo();
81 #pragma omp target teams distribute simd
82 for (int i = 0; i < argc; ++i) {
83 return 1; // expected-error {{cannot return from OpenMP region}}
86 [[]] // expected-error {{an attribute list cannot appear here}}
87 #pragma omp target teams distribute simd
88 for (int n = 0; n < 100; ++n) {
91 #pragma omp target teams distribute simd copyin(pvt) // expected-error {{unexpected OpenMP clause 'copyin' in directive '#pragma omp target teams distribute simd'}}
92 for (int n = 0; n < 100; ++n) {}
94 return 0;
97 void test_ordered() {
98 #pragma omp target teams distribute simd ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp target teams distribute simd'}}
99 for (int i = 0; i < 16; ++i)