| 1 |
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized |
| 2 |
|
| 3 |
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized |
| 4 |
|
| 5 |
void foo() { |
| 6 |
} |
| 7 |
|
| 8 |
bool foobool(int argc) { |
| 9 |
return argc; |
| 10 |
} |
| 11 |
|
| 12 |
struct S1; // expected-note {{declared here}} |
| 13 |
|
| 14 |
template <class T, typename S, int N, int ST> // expected-note {{declared here}} |
| 15 |
T tmain(T argc, S **argv) { |
| 16 |
T z; |
| 17 |
// expected-error@+1 {{expected '(' after 'schedule'}} |
| 18 |
#pragma omp target teams distribute parallel for schedule |
| 19 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 20 |
|
| 21 |
// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 22 |
#pragma omp target teams distribute parallel for schedule ( |
| 23 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 24 |
|
| 25 |
// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} |
| 26 |
#pragma omp target teams distribute parallel for schedule () |
| 27 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 28 |
|
| 29 |
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 30 |
#pragma omp target teams distribute parallel for schedule (auto |
| 31 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 32 |
|
| 33 |
// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 34 |
#pragma omp target teams distribute parallel for schedule (auto_dynamic |
| 35 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 36 |
|
| 37 |
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 38 |
#pragma omp target teams distribute parallel for schedule (auto, |
| 39 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 40 |
|
| 41 |
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 42 |
#pragma omp target teams distribute parallel for schedule (runtime, 3) |
| 43 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 44 |
|
| 45 |
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 46 |
#pragma omp target teams distribute parallel for schedule (guided argc |
| 47 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 48 |
|
| 49 |
// expected-error@+1 2 {{argument to 'schedule' clause must be a strictly positive integer value}} |
| 50 |
#pragma omp target teams distribute parallel for schedule (static, ST // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 51 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 52 |
|
| 53 |
// expected-warning@+1 {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}} |
| 54 |
#pragma omp target teams distribute parallel for schedule (dynamic, z+1)) |
| 55 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 56 |
|
| 57 |
#pragma omp target teams distribute parallel for schedule (guided, (ST > 0) ? 1 + ST : 2) |
| 58 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 59 |
|
| 60 |
// expected-error@+2 2 {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'schedule' clause}} |
| 61 |
// expected-error@+1 {{argument to 'schedule' clause must be a strictly positive integer value}} |
| 62 |
#pragma omp target teams distribute parallel for schedule (static, foobool(argc)), schedule (dynamic, true), schedule (guided, -5) |
| 63 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 64 |
|
| 65 |
// expected-error@+1 {{'S' does not refer to a value}} |
| 66 |
#pragma omp target teams distribute parallel for schedule (static, S) |
| 67 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 68 |
|
| 69 |
// expected-error@+2 2 {{expression must have integral or unscoped enumeration type, not 'char *'}} |
| 70 |
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 71 |
#pragma omp target teams distribute parallel for schedule (guided, argv[1]=2) |
| 72 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 73 |
|
| 74 |
#pragma omp target teams distribute parallel for schedule (dynamic, 1) |
| 75 |
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 76 |
|
| 77 |
// expected-error@+1 {{argument to 'schedule' clause must be a strictly positive integer value}} |
| 78 |
#pragma omp target teams distribute parallel for schedule (static, N) |
| 79 |
for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 80 |
|
| 81 |
return argc; |
| 82 |
} |
| 83 |
|
| 84 |
int main(int argc, char **argv) { |
| 85 |
int z; |
| 86 |
// expected-error@+1 {{expected '(' after 'schedule'}} |
| 87 |
#pragma omp target teams distribute parallel for schedule |
| 88 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 89 |
|
| 90 |
// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 91 |
#pragma omp target teams distribute parallel for schedule ( |
| 92 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 93 |
|
| 94 |
// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} |
| 95 |
#pragma omp target teams distribute parallel for schedule () |
| 96 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 97 |
|
| 98 |
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 99 |
#pragma omp target teams distribute parallel for schedule (auto |
| 100 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 101 |
|
| 102 |
// expected-error@+1 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 103 |
#pragma omp target teams distribute parallel for schedule (auto_dynamic |
| 104 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 105 |
|
| 106 |
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 107 |
#pragma omp target teams distribute parallel for schedule (auto, |
| 108 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 109 |
|
| 110 |
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 111 |
#pragma omp target teams distribute parallel for schedule (runtime, 3) |
| 112 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 113 |
|
| 114 |
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 115 |
#pragma omp target teams distribute parallel for schedule (guided, 4 |
| 116 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 117 |
|
| 118 |
// expected-warning@+1 {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}} |
| 119 |
#pragma omp target teams distribute parallel for schedule (static, 2+2 + z)) |
| 120 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 121 |
|
| 122 |
#pragma omp target teams distribute parallel for schedule (dynamic, foobool(1) > 0 ? 1 : 2) |
| 123 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 124 |
|
| 125 |
// expected-error@+2 2 {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'schedule' clause}} |
| 126 |
// expected-error@+1 {{argument to 'schedule' clause must be a strictly positive integer value}} |
| 127 |
#pragma omp target teams distribute parallel for schedule (guided, foobool(argc)), schedule (static, true), schedule (dynamic, -5) |
| 128 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 129 |
|
| 130 |
// expected-error@+1 {{'S1' does not refer to a value}} |
| 131 |
#pragma omp target teams distribute parallel for schedule (guided, S1) |
| 132 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 133 |
|
| 134 |
// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} |
| 135 |
// expected-error@+1 {{expression must have integral or unscoped enumeration type, not 'char *'}} |
| 136 |
#pragma omp target teams distribute parallel for schedule (static, argv[1]=2) |
| 137 |
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 138 |
|
| 139 |
// expected-error@+3 {{statement after '#pragma omp target teams distribute parallel for' must be a for loop}} |
| 140 |
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}} |
| 141 |
#pragma omp target teams distribute parallel for schedule(dynamic, schedule(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} |
| 142 |
foo(); |
| 143 |
|
| 144 |
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}} |
| 145 |
return tmain<int, char, 1, 0>(argc, argv); |
| 146 |
} |
| 147 |
|