| 1 |
// RUN: %clang_cc1 %s -verify -fopenacc |
| 2 |
|
| 3 |
struct S { |
| 4 |
int foo; |
| 5 |
char Array[1]; |
| 6 |
}; |
| 7 |
char *getArrayPtr(); |
| 8 |
void func() { |
| 9 |
char Array[10]; |
| 10 |
char *ArrayPtr = getArrayPtr(); |
| 11 |
int *readonly; |
| 12 |
struct S s; |
| 13 |
|
| 14 |
for (int i = 0; i < 10; ++i) { |
| 15 |
// expected-error@+2{{expected '('}} |
| 16 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 17 |
#pragma acc cache |
| 18 |
} |
| 19 |
|
| 20 |
for (int i = 0; i < 10; ++i) { |
| 21 |
// expected-error@+3{{expected '('}} |
| 22 |
// expected-error@+2{{invalid OpenACC clause 'clause'}} |
| 23 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 24 |
#pragma acc cache clause list |
| 25 |
} |
| 26 |
|
| 27 |
for (int i = 0; i < 10; ++i) { |
| 28 |
// expected-error@+2{{expected expression}} |
| 29 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 30 |
#pragma acc cache() |
| 31 |
} |
| 32 |
|
| 33 |
for (int i = 0; i < 10; ++i) { |
| 34 |
// expected-error@+3{{expected expression}} |
| 35 |
// expected-error@+2{{invalid OpenACC clause 'clause'}} |
| 36 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 37 |
#pragma acc cache() clause-list |
| 38 |
} |
| 39 |
|
| 40 |
for (int i = 0; i < 10; ++i) { |
| 41 |
// expected-error@+3{{expected ')'}} |
| 42 |
// expected-note@+2{{to match this '('}} |
| 43 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 44 |
#pragma acc cache( |
| 45 |
} |
| 46 |
|
| 47 |
for (int i = 0; i < 10; ++i) { |
| 48 |
// expected-error@+4{{use of undeclared identifier 'invalid'}} |
| 49 |
// expected-error@+3{{expected ')'}} |
| 50 |
// expected-note@+2{{to match this '('}} |
| 51 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 52 |
#pragma acc cache(invalid |
| 53 |
} |
| 54 |
|
| 55 |
for (int i = 0; i < 10; ++i) { |
| 56 |
// expected-error@+3{{expected ')'}} |
| 57 |
// expected-note@+2{{to match this '('}} |
| 58 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 59 |
#pragma acc cache(ArrayPtr |
| 60 |
} |
| 61 |
|
| 62 |
for (int i = 0; i < 10; ++i) { |
| 63 |
// expected-error@+2{{use of undeclared identifier 'invalid'}} |
| 64 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 65 |
#pragma acc cache(invalid) |
| 66 |
} |
| 67 |
|
| 68 |
for (int i = 0; i < 10; ++i) { |
| 69 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 70 |
#pragma acc cache(ArrayPtr) |
| 71 |
} |
| 72 |
|
| 73 |
for (int i = 0; i < 10; ++i) { |
| 74 |
// expected-error@+6{{expected expression}} |
| 75 |
// expected-error@+5{{expected ']'}} |
| 76 |
// expected-note@+4{{to match this '['}} |
| 77 |
// expected-error@+3{{expected ')'}} |
| 78 |
// expected-note@+2{{to match this '('}} |
| 79 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 80 |
#pragma acc cache(ArrayPtr[ |
| 81 |
} |
| 82 |
|
| 83 |
for (int i = 0; i < 10; ++i) { |
| 84 |
// expected-error@+4{{expected expression}} |
| 85 |
// expected-error@+3{{expected ']'}} |
| 86 |
// expected-note@+2{{to match this '['}} |
| 87 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 88 |
#pragma acc cache(ArrayPtr[, 5) |
| 89 |
} |
| 90 |
|
| 91 |
for (int i = 0; i < 10; ++i) { |
| 92 |
// expected-error@+4{{expected expression}} |
| 93 |
// expected-error@+3{{expected ']'}} |
| 94 |
// expected-note@+2{{to match this '['}} |
| 95 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 96 |
#pragma acc cache(Array[) |
| 97 |
} |
| 98 |
|
| 99 |
for (int i = 0; i < 10; ++i) { |
| 100 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 101 |
#pragma acc cache(Array[*readonly]) |
| 102 |
} |
| 103 |
|
| 104 |
for (int i = 0; i < 10; ++i) { |
| 105 |
// expected-error@+6{{expected expression}} |
| 106 |
// expected-error@+5{{expected ']'}} |
| 107 |
// expected-note@+4{{to match this '['}} |
| 108 |
// expected-error@+3{{expected ')'}} |
| 109 |
// expected-note@+2{{to match this '('}} |
| 110 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 111 |
#pragma acc cache(Array[*readonly: |
| 112 |
} |
| 113 |
|
| 114 |
for (int i = 0; i < 10; ++i) { |
| 115 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 116 |
#pragma acc cache(readonly) |
| 117 |
} |
| 118 |
|
| 119 |
for (int i = 0; i < 10; ++i) { |
| 120 |
// expected-error@+2{{invalid tag 'devnum' on 'cache' directive}} |
| 121 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 122 |
#pragma acc cache(devnum:ArrayPtr) |
| 123 |
} |
| 124 |
|
| 125 |
for (int i = 0; i < 10; ++i) { |
| 126 |
// expected-error@+2{{invalid tag 'invalid' on 'cache' directive}} |
| 127 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 128 |
#pragma acc cache(invalid:ArrayPtr) |
| 129 |
} |
| 130 |
|
| 131 |
for (int i = 0; i < 10; ++i) { |
| 132 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 133 |
#pragma acc cache(readonly:ArrayPtr) |
| 134 |
} |
| 135 |
|
| 136 |
for (int i = 0; i < 10; ++i) { |
| 137 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 138 |
#pragma acc cache(readonly:ArrayPtr[5:1]) |
| 139 |
} |
| 140 |
|
| 141 |
for (int i = 0; i < 10; ++i) { |
| 142 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 143 |
#pragma acc cache(readonly:ArrayPtr[5:*readonly]) |
| 144 |
} |
| 145 |
|
| 146 |
for (int i = 0; i < 10; ++i) { |
| 147 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 148 |
#pragma acc cache(readonly:ArrayPtr[5:*readonly], Array) |
| 149 |
} |
| 150 |
|
| 151 |
for (int i = 0; i < 10; ++i) { |
| 152 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 153 |
#pragma acc cache(readonly:ArrayPtr[5:*readonly], Array[*readonly:3]) |
| 154 |
} |
| 155 |
|
| 156 |
for (int i = 0; i < 10; ++i) { |
| 157 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 158 |
#pragma acc cache(readonly:ArrayPtr[5 + i:*readonly], Array[*readonly + i:3]) |
| 159 |
} |
| 160 |
|
| 161 |
for (int i = 0; i < 10; ++i) { |
| 162 |
// expected-error@+4{{expected expression}} |
| 163 |
// expected-error@+3{{expected ')'}} |
| 164 |
// expected-note@+2{{to match this '('}} |
| 165 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 166 |
#pragma acc cache(readonly:ArrayPtr[5:*readonly], |
| 167 |
} |
| 168 |
|
| 169 |
for (int i = 0; i < 10; ++i) { |
| 170 |
// expected-error@+2{{expected expression}} |
| 171 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 172 |
#pragma acc cache(readonly:ArrayPtr[5:*readonly],) |
| 173 |
} |
| 174 |
|
| 175 |
for (int i = 0; i < 10; ++i) { |
| 176 |
// expected-warning@+2{{left operand of comma operator has no effect}} |
| 177 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 178 |
#pragma acc cache(readonly:ArrayPtr[5,6:*readonly]) |
| 179 |
} |
| 180 |
|
| 181 |
for (int i = 0; i < 10; ++i) { |
| 182 |
// expected-warning@+2{{left operand of comma operator has no effect}} |
| 183 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 184 |
#pragma acc cache(readonly:ArrayPtr[5:3, *readonly], ArrayPtr[0]) |
| 185 |
} |
| 186 |
|
| 187 |
for (int i = 0; i < 10; ++i) { |
| 188 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 189 |
#pragma acc cache(readonly:s.foo) |
| 190 |
} |
| 191 |
|
| 192 |
for (int i = 0; i < 10; ++i) { |
| 193 |
// expected-warning@+2{{left operand of comma operator has no effect}} |
| 194 |
// expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}} |
| 195 |
#pragma acc cache(readonly:s.Array[1,2]) |
| 196 |
} |
| 197 |
} |