brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.1 KiB · 5a44c36 Raw
128 lines · cpp
1// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ferror-limit 100 -o - %s -Wuninitialized2 3// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 -o - %s -Wuninitialized4 5// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized -DOMP51 6 7// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized -DOMP51 8 9void foo();10 11namespace {12static int y = 0;13}14static int x = 0;15 16template <class T, int N>17T tmain(T argc) {18  int i;19#pragma omp target20#pragma omp teams21#pragma omp distribute parallel for simd default // expected-error {{expected '(' after 'default'}}22  for (i = 0; i < argc; ++i)23    foo();24#pragma omp target25#pragma omp teams26#pragma omp distribute parallel for simd default( // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}27  for (i = 0; i < argc; ++i)28    foo();29#pragma omp target30#pragma omp teams31#pragma omp distribute parallel for simd default() // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}32  for (i = 0; i < argc; ++i)33    foo();34#pragma omp target35#pragma omp teams36#pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note 2 {{explicit data sharing attribute requested here}}37  for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}}38    foo();39#pragma omp target40#pragma omp teams41#pragma omp distribute parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'default' clause}}42  for (i = 0; i < argc; ++i)43    foo();44#pragma omp target45#pragma omp teams46#pragma omp distribute parallel for simd default(x) // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}47  for (i = 0; i < argc; ++i)48    foo();49#pragma omp target50#pragma omp teams51#pragma omp distribute parallel for simd default(none) // expected-note 2 {{explicit data sharing attribute requested here}}52  for (i = 0; i < argc; ++i)  // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}}53    foo();54 55#pragma omp parallel default(none) // expected-note 4 {{explicit data sharing attribute requested here}}56#pragma omp target57#pragma omp teams58#pragma omp distribute parallel for simd default(shared)59  for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} expected-error 2 {{variable 'i' must have explicitly specified data sharing attributes}}60    foo();61 62  return T();63}64 65int main(int argc, char **argv) {66  int i;67#pragma omp target68#pragma omp teams69#pragma omp distribute parallel for simd default // expected-error {{expected '(' after 'default'}}70  for (i = 0; i < argc; ++i)71    foo();72#pragma omp target73#pragma omp teams74#pragma omp distribute parallel for simd default( // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}75  for (i = 0; i < argc; ++i)76    foo();77#pragma omp target78#pragma omp teams79#pragma omp distribute parallel for simd default() // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}80  for (i = 0; i < argc; ++i)81    foo();82#pragma omp target83#pragma omp teams84#pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}85  for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}86    foo();87#pragma omp target88#pragma omp teams89#pragma omp distribute parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'default' clause}}90  for (i = 0; i < argc; ++i)91    foo();92#pragma omp target93#pragma omp teams94#pragma omp distribute parallel for simd default(x) // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}95  for (i = 0; i < argc; ++i)96    foo();97#pragma omp target98#pragma omp teams99#pragma omp distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}100  for (i = 0; i < argc; ++i)  // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}101    foo();102#ifdef OMP51103#pragma omp target104#pragma omp teams105#pragma omp distribute parallel for simd default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}}106  for (i = 0; i < argc; ++i) {107    ++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}108    ++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}109  }110#pragma omp target111#pragma omp teams112#pragma omp distribute parallel for simd default(private) // expected-note 2 {{explicit data sharing attribute requested here}}113  for (i = 0; i < argc; ++i) {114    ++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}}115    ++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}}116  }117#endif118 119#pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}}120#pragma omp target121#pragma omp teams122#pragma omp distribute parallel for simd default(shared)123  for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} expected-error {{variable 'i' must have explicitly specified data sharing attributes}}124    foo();125 126  return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain<int, 5>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<char, 1>' requested here}}127}128