176 lines · cpp
1// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized2 3// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized4 5void foo() {6}7 8bool foobool(int argc) {9 return argc;10}11 12struct S1; // expected-note {{declared here}}13 14template <class T, typename S, int N, int ST> // expected-note {{declared here}}15T tmain(T argc, S **argv) {16 T k;17// expected-error@+2 {{expected '(' after 'schedule'}}18#pragma omp target19#pragma omp teams distribute parallel for schedule20 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];21 22// expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}23#pragma omp target24#pragma omp teams distribute parallel for schedule (25 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];26 27// expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}}28#pragma omp target29#pragma omp teams distribute parallel for schedule ()30 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];31 32// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}33#pragma omp target34#pragma omp teams distribute parallel for schedule (auto35 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];36 37// expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}38#pragma omp target39#pragma omp teams distribute parallel for schedule (auto_dynamic40 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];41 42// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}43#pragma omp target44#pragma omp teams distribute parallel for schedule (auto,45 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];46 47// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}48#pragma omp target49#pragma omp teams distribute parallel for schedule (runtime, 3)50 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];51 52// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}53#pragma omp target54#pragma omp teams distribute parallel for schedule (guided argc55 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];56 57// expected-error@+2 2 {{argument to 'schedule' clause must be a strictly positive integer value}}58#pragma omp target59#pragma omp teams distribute parallel for schedule (static, ST // expected-error {{expected ')'}} expected-note {{to match this '('}}60 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];61 62// expected-warning@+2 {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}63#pragma omp target64#pragma omp teams distribute parallel for schedule (dynamic, 1))65 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];66 67#pragma omp target68#pragma omp teams distribute parallel for schedule (guided, (ST > 0) ? 1 + ST : 2)69 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];70 71// expected-error@+3 2 {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'schedule' clause}}72// expected-error@+2 {{argument to 'schedule' clause must be a strictly positive integer value}}73#pragma omp target74#pragma omp teams distribute parallel for schedule (static, foobool(argc)), schedule (dynamic, true), schedule (guided, -5)75 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];76 77// expected-error@+2 {{'S' does not refer to a value}}78#pragma omp target79#pragma omp teams distribute parallel for schedule (static, S)80 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];81 82// expected-error@+3 2 {{expression must have integral or unscoped enumeration type, not 'char *'}}83// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}84#pragma omp target85#pragma omp teams distribute parallel for schedule (guided, argv[1]=2)86 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];87 88#pragma omp target89#pragma omp teams distribute parallel for schedule (dynamic, k)90 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];91 92// expected-error@+2 {{argument to 'schedule' clause must be a strictly positive integer value}}93#pragma omp target94#pragma omp teams distribute parallel for schedule (static, N)95 for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];96 97 return argc;98}99 100int main(int argc, char **argv) {101// expected-error@+2 {{expected '(' after 'schedule'}}102#pragma omp target103#pragma omp teams distribute parallel for schedule104 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];105 106// expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}107#pragma omp target108#pragma omp teams distribute parallel for schedule (109 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];110 111// expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}}112#pragma omp target113#pragma omp teams distribute parallel for schedule ()114 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];115 116// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}117#pragma omp target118#pragma omp teams distribute parallel for schedule (auto119 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];120 121// expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}122#pragma omp target123#pragma omp teams distribute parallel for schedule (auto_dynamic124 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];125 126// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}127#pragma omp target128#pragma omp teams distribute parallel for schedule (auto,129 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];130 131// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}132#pragma omp target133#pragma omp teams distribute parallel for schedule (runtime, 3)134 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];135 136// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}137#pragma omp target138#pragma omp teams distribute parallel for schedule (guided, 4139 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];140 141// expected-warning@+2 {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}142#pragma omp target143#pragma omp teams distribute parallel for schedule (static, 2+2))144 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];145 146#pragma omp target147#pragma omp teams distribute parallel for schedule (dynamic, foobool(1) > 0 ? 1 : 2)148 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];149 150// expected-error@+3 2 {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'schedule' clause}}151// expected-error@+2 {{argument to 'schedule' clause must be a strictly positive integer value}}152#pragma omp target153#pragma omp teams distribute parallel for schedule (guided, foobool(argc)), schedule (static, true), schedule (dynamic, -5)154 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];155 156// expected-error@+2 {{'S1' does not refer to a value}}157#pragma omp target158#pragma omp teams distribute parallel for schedule (guided, S1)159 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];160 161// expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}162// expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'char *'}}163#pragma omp target164#pragma omp teams distribute parallel for schedule (static, argv[1]=2)165 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];166 167// expected-error@+4 {{statement after '#pragma omp teams distribute parallel for' must be a for loop}}168// expected-note@+2 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}169#pragma omp target170#pragma omp teams distribute parallel for schedule(dynamic, schedule(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}171 foo();172 173 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}}174 return tmain<int, char, 1, 0>(argc, argv);175}176