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