1 // RUN: %clang_cc1 -verify=expected,omp4 -fopenmp -fopenmp-version=45 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp5 -fopenmp -fopenmp-version=50 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
3
4 // RUN: %clang_cc1 -verify=expected,omp4 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp5 -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
6
foo()7 void foo() {
8 }
9
foobool(int argc)10 bool foobool(int argc) {
11 return argc;
12 }
13
14 struct S1; // expected-note {{declared here}}
15
16 class vector {
17 public:
operator [](int index)18 int operator[](int index) { return 0; }
19 };
20
main(int argc,char ** argv,char * env[])21 int main(int argc, char **argv, char *env[]) {
22 vector vec;
23 typedef float V __attribute__((vector_size(16)));
24 V a;
25 auto arr = x; // expected-error {{use of undeclared identifier 'x'}}
26 int i;
27
28 #pragma omp target teams distribute depend // expected-error {{expected '(' after 'depend'}}
29 for (i = 0; i < argc; ++i) foo();
30 #pragma omp target teams distribute depend( // omp4-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} omp5-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset' or 'depobj' in OpenMP clause 'depend'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}}
31 for (i = 0; i < argc; ++i) foo();
32 #pragma omp target teams distribute depend() // omp4-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} omp5-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset' or 'depobj' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}}
33 for (i = 0; i < argc; ++i) foo();
34 #pragma omp target teams distribute depend(argc // omp4-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} omp5-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset' or 'depobj' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
35 for (i = 0; i < argc; ++i) foo();
36 #pragma omp target teams distribute depend(source : argc) // omp4-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} omp5-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset' or 'depobj' in OpenMP clause 'depend'}}
37 for (i = 0; i < argc; ++i)
38 foo();
39 #pragma omp target teams distribute depend(source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} omp4-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} omp5-error {{expected depend modifier(iterator) or 'in', 'out', 'inout', 'mutexinoutset' or 'depobj' in OpenMP clause 'depend'}}
40 for (i = 0; i < argc; ++i) foo();
41 #pragma omp target teams distribute depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}}
42 for (i = 0; i < argc; ++i) foo();
43 #pragma omp target teams distribute depend (out: ) // expected-error {{expected expression}}
44 for (i = 0; i < argc; ++i)
45 foo();
46 #pragma omp target teams distribute depend(inout : foobool(argc)), depend(in, argc) // omp4-error {{expected addressable lvalue expression, array element or array section}} omp5-error {{expected addressable lvalue expression, array element, array section or array shaping expression of non 'omp_depend_t' type}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}}
47 for (i = 0; i < argc; ++i) foo();
48 #pragma omp target teams distribute depend (out :S1) // expected-error {{'S1' does not refer to a value}}
49 for (i = 0; i < argc; ++i)
50 foo();
51 #pragma omp target teams distribute depend(in : argv[1][1] = '2')
52 for (i = 0; i < argc; ++i) foo();
53 #pragma omp target teams distribute depend(in : vec[1]) // omp4-error {{expected addressable lvalue expression, array element or array section}} omp5-error {{expected addressable lvalue expression, array element, array section or array shaping expression of non 'omp_depend_t' type}}
54 for (i = 0; i < argc; ++i) foo();
55 #pragma omp target teams distribute depend (in : argv[0])
56 for (i = 0; i < argc; ++i) foo();
57 #pragma omp target teams distribute depend(in:) // expected-error {{expected expression}}
58 for (i = 0; i < argc; ++i) foo();
59 #pragma omp target teams distribute depend (in : main)
60 for (i = 0; i < argc; ++i) foo();
61 #pragma omp target teams distribute depend(in : a[0]) // omp4-error {{expected addressable lvalue expression, array element or array section}} omp5-error {{expected addressable lvalue expression, array element, array section or array shaping expression of non 'omp_depend_t' type}}
62 for (i = 0; i < argc; ++i) foo();
63 #pragma omp target teams distribute depend (in : vec[1:2]) // expected-error {{ value is not an array or pointer}}
64 for (i = 0; i < argc; ++i) foo();
65 #pragma omp target teams distribute depend (in : argv[ // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
66 for (i = 0; i < argc; ++i) foo();
67 #pragma omp target teams distribute depend (in : argv[: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
68 for (i = 0; i < argc; ++i) foo();
69 #pragma omp target teams distribute depend (in : argv[:] // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} expected-error {{expected ')'}} expected-note {{to match this '('}}
70 for (i = 0; i < argc; ++i) foo();
71 #pragma omp target teams distribute depend (in : argv[argc: // expected-error {{expected expression}} expected-error {{expected ']'}} expected-error {{expected ')'}} expected-note {{to match this '['}} expected-note {{to match this '('}}
72 for (i = 0; i < argc; ++i) foo();
73 #pragma omp target teams distribute depend (in : argv[argc:argc] // expected-error {{expected ')'}} expected-note {{to match this '('}}
74 for (i = 0; i < argc; ++i) foo();
75 #pragma omp target teams distribute depend (in : argv[0:-1]) // expected-error {{section length is evaluated to a negative value -1}}
76 for (i = 0; i < argc; ++i) foo();
77 #pragma omp target teams distribute depend (in : argv[-1:0]) // expected-error {{zero-length array section is not allowed in 'depend' clause}}
78 for (i = 0; i < argc; ++i) foo();
79 #pragma omp target teams distribute depend (in : argv[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
80 for (i = 0; i < argc; ++i) foo();
81 #pragma omp target teams distribute depend(in : argv [3:4:1]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
82 for (i = 0; i < argc; ++i) foo();
83 #pragma omp target teams distribute depend(in:a[0:1]) // expected-error {{subscripted value is not an array or pointer}}
84 for (i = 0; i < argc; ++i) foo();
85 #pragma omp target teams distribute depend(in:argv[argv[:2]:1]) // expected-error {{OpenMP array section is not allowed here}}
86 for (i = 0; i < argc; ++i) foo();
87 #pragma omp target teams distribute depend(in:argv[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
88 for (i = 0; i < argc; ++i) foo();
89 #pragma omp target teams distribute depend(in:env[0:][:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is an array of unknown bound}}
90 for (i = 0; i < argc; ++i) foo();
91 #pragma omp target teams distribute depend(in : argv[ : argc][1 : argc - 1])
92 for (i = 0; i < argc; ++i) foo();
93 #pragma omp target teams distribute depend(in : arr[0])
94 for (i = 0; i < argc; ++i) foo();
95
96 return 0;
97 }
98