brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.6 KiB · b0ec2ba Raw
136 lines · cpp
1// RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++11 %s -Wuninitialized2// RUN: %clang_cc1 -verify=expected,omp5,omp50 -fopenmp -fopenmp-version=50 -std=c++11 %s -Wuninitialized3// RUN: %clang_cc1 -verify=expected,omp5,omp51 -fopenmp -std=c++11 %s -Wuninitialized4 5// RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++11 %s -Wuninitialized6// RUN: %clang_cc1 -verify=expected,omp5,omp50 -fopenmp-simd -fopenmp-version=50 -std=c++11 %s -Wuninitialized7// RUN: %clang_cc1 -verify=expected,omp5,omp51 -fopenmp-simd -std=c++11 %s -Wuninitialized8 9void xxx(int argc) {10  int x; // expected-note {{initialize the variable 'x' to silence this warning}}11#pragma omp target teams distribute parallel for12  for (int i = 0; i < 10; ++i)13    argc = x; // expected-warning {{variable 'x' is uninitialized when used here}}14}15 16void foo() {17}18 19static int pvt;20#pragma omp threadprivate(pvt)21 22#pragma omp target teams distribute parallel for // expected-error {{unexpected OpenMP directive '#pragma omp target teams distribute parallel for'}}23 24int main(int argc, char **argv) {25#pragma omp target teams distribute parallel for { // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}26  for (int i = 0; i < argc; ++i)27    foo();28#pragma omp target teams distribute parallel for ( // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}29  for (int i = 0; i < argc; ++i)30    foo();31#pragma omp target teams distribute parallel for[ // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}32  for (int i = 0; i < argc; ++i)33    foo();34#pragma omp target teams distribute parallel for] // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}35  for (int i = 0; i < argc; ++i)36    foo();37#pragma omp target teams distribute parallel for) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}38  for (int i = 0; i < argc; ++i)39    foo();40#pragma omp target teams distribute parallel for } // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}41  for (int i = 0; i < argc; ++i)42    foo();43#pragma omp target teams distribute parallel for linear(argc) // expected-error {{unexpected OpenMP clause 'linear' in directive '#pragma omp target teams distribute parallel for'}}44  for (int i = 0; i < argc; ++i)45    foo();46// expected-warning@+1 {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}47#pragma omp target teams distribute parallel for unknown()48  for (int i = 0; i < argc; ++i)49    foo();50L1:51  for (int i = 0; i < argc; ++i)52    foo();53#pragma omp target teams distribute parallel for54  for (int i = 0; i < argc; ++i)55    foo();56#pragma omp target teams distribute parallel for57  for (int i = 0; i < argc; ++i) {58    goto L1; // expected-error {{use of undeclared label 'L1'}}59    argc++;60  }61 62  for (int i = 0; i < 10; ++i) {63    switch (argc) {64    case (0):65#pragma omp target teams distribute parallel for66      for (int i = 0; i < argc; ++i) {67        foo();68        break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}69        continue;70      }71    default:72      break;73    }74  }75#pragma omp target teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}76  for (int i = 0; i < 10; ++i)77    ++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}}78 79  goto L2; // expected-error {{use of undeclared label 'L2'}}80#pragma omp target teams distribute parallel for81  for (int i = 0; i < argc; ++i)82  L2: foo();83 84#pragma omp target teams distribute parallel for85  for (int i = 0; i < argc; ++i) {86    return 1; // expected-error {{cannot return from OpenMP region}}87  }88 89  [[]] // expected-error {{an attribute list cannot appear here}}90#pragma omp target teams distribute parallel for91      for (int n = 0; n < 100; ++n) {92  }93 94#pragma omp target teams distribute parallel for copyin(pvt) // expected-error {{unexpected OpenMP clause 'copyin' in directive '#pragma omp target teams distribute parallel for'}}95  for (int n = 0; n < 100; ++n) {}96 97  return 0;98}99 100void test_ordered() {101#pragma omp target teams distribute parallel for ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp target teams distribute parallel for'}}102  for (int i = 0; i < 16; ++i)103    ;104#pragma omp target teams distribute parallel for order // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} expected-error {{expected '(' after 'order'}}105  for (int i = 0; i < 10; ++i)106    ;107#pragma omp target teams distribute parallel for order( // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}108  for (int i = 0; i < 10; ++i)109    ;110#pragma omp target teams distribute parallel for order(none // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}111  for (int i = 0; i < 10; ++i)112    ;113#pragma omp target teams distribute parallel for order(concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}}114  for (int i = 0; i < 10; ++i)115    ;116#pragma omp target teams distribute parallel for order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}}117  for (int i = 0; i < 10; ++i)118    ;119#pragma omp target teams distribute parallel for order(unconstrained:) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}120  for (int i = 0; i < 10; ++i)121    ;122#pragma omp target teams distribute parallel for order(reproducible:concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}123  for (int i = 0; i < 10; ++i)124    ;125#pragma omp target teams distribute parallel for order(reproducible:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}126  for (int i = 0; i < 10; ++i)127    ;128#pragma omp target teams distribute parallel for order(unconstrained:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}129  for (int i = 0; i < 10; ++i)130    ;131#pragma omp target teams distribute parallel for order(concurrent) order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} omp51-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'order' clause}}132  for (int i = 0; i < 10; ++i)133    ;134}135 136