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