blob: 17d5ed83e162f22b1bdb9416cd4c13e5d81a6a50 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++17 -fopenmp -fsyntax-only -Wuninitialized -verify %s
void func(int n) {
// expected-error@+2 {{statement after '#pragma omp unroll' must be a for loop}}
#pragma omp unroll
func(n);
// expected-error@+2 {{statement after '#pragma omp unroll' must be a for loop}}
#pragma omp unroll
;
// expected-error@+2 {{the loop condition expression depends on the current loop control variable}}
#pragma omp unroll
for (int i = 0; i < 2*(i-4); ++i) {}
// expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
#pragma omp unroll
for (int i = 0; i/3 < 7; ++i) {}
// expected-warning@+1 {{extra tokens at the end of '#pragma omp unroll' are ignored}}
#pragma omp unroll foo
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
#pragma omp unroll partial(
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
#pragma omp unroll partial(4
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
#pragma omp unroll partial(4+
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
#pragma omp unroll partial(for)
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{integral constant expression must have integral or unscoped enumeration type, not 'void (int)'}}
#pragma omp unroll partial(func)
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{expected expression}}
#pragma omp unroll partial()
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
#pragma omp unroll partial(4,4)
for (int i = 0; i < n; ++i) {}
// expected-error@+3 {{expression is not an integral constant expression}} expected-note@+3 {{read of non-const variable 'a' is not allowed in a constant expression}}
// expected-note@+1 {{declared here}}
int a;
#pragma omp unroll partial(a)
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{argument to 'partial' clause must be a strictly positive integer value}}
#pragma omp unroll partial(0)
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{directive '#pragma omp unroll' cannot contain more than one 'partial' clause}}
#pragma omp unroll partial partial
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{directive '#pragma omp unroll' cannot contain more than one 'partial' clause}}
#pragma omp unroll partial(4) partial
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{directive '#pragma omp unroll' cannot contain more than one 'full' clause}}
#pragma omp unroll full full
for (int i = 0; i < 128; ++i) {}
// expected-error@+1 {{'full' and 'partial' clause are mutually exclusive and may not appear on the same directive}} expected-note@+1 {{'partial' clause is specified here}}
#pragma omp unroll partial full
for (int i = 0; i < n; ++i) {}
// expected-error@+1 {{'partial' and 'full' clause are mutually exclusive and may not appear on the same directive}} expected-note@+1 {{'full' clause is specified here}}
#pragma omp unroll full partial
for (int i = 0; i < n; ++i) {}
// expected-error@+2 {{loop to be fully unrolled must have a constant trip count}} expected-note@+1 {{'#pragma omp unroll full' directive found here}}
#pragma omp unroll full
for (int i = 0; i < n; ++i) {}
// expected-error@+2 {{statement after '#pragma omp for' must be a for loop}}
#pragma omp for
#pragma omp unroll
for (int i = 0; i < n; ++i) {}
// expected-error@+2 {{statement after '#pragma omp for' must be a for loop}}
#pragma omp for
#pragma omp unroll full
for (int i = 0; i < 128; ++i) {}
// expected-error@+2 {{statement after '#pragma omp unroll' must be a for loop}}
#pragma omp unroll
#pragma omp unroll
for (int i = 0; i < n; ++i) {}
// expected-error@+2 {{statement after '#pragma omp tile' must be a for loop}}
#pragma omp tile sizes(4)
#pragma omp unroll
for (int i = 0; i < n; ++i) {}
// expected-error@+4 {{expected 2 for loops after '#pragma omp for', but found only 1}}
// expected-note@+1 {{as specified in 'collapse' clause}}
#pragma omp for collapse(2)
for (int i = 0; i < n; ++i) {
#pragma omp unroll full
for (int j = 0; j < 128; ++j) {}
}
}
template<typename T, int Factor>
void templated_func(int n) {
// expected-error@+1 {{argument to 'partial' clause must be a strictly positive integer value}}
#pragma omp unroll partial(Factor)
for (T i = 0; i < n; ++i) {}
// expected-error@+2 {{loop to be fully unrolled must have a constant trip count}} expected-note@+1 {{'#pragma omp unroll full' directive found here}}
#pragma omp unroll full
for (int i = 0; i < n; i-=Factor) {}
}
void template_inst(int n) {
// expected-note@+1 {{in instantiation of function template specialization 'templated_func<int, -1>' requested here}}
templated_func<int, -1>(n);
}
namespace GH139267 {
void f(void) {
// This would previously crash with follow-on recovery after issuing the error.
#pragma omp unroll partial(a) // expected-error {{use of undeclared identifier 'a'}}
for (int i = 0; i < 10; i++)
;
}
}
|