| 1 |
/* Test 'cache' directive diagnostics. */ |
| 2 |
|
| 3 |
/* See also corresponding C++ variant: '../../g++.dg/goacc/cache-3-2.C'. */ |
| 4 |
|
| 5 |
/* See also corresponding C/C++ data clause variant: 'data-clause-2.c'. */ |
| 6 |
|
| 7 |
/* The current implementation doesn't restrict where a 'cache' directive may |
| 8 |
appear, so we don't make any special arrangements. */ |
| 9 |
|
| 10 |
void |
| 11 |
foo (int *p, int (*q)[10], int r[10], int s[10][10]) |
| 12 |
{ |
| 13 |
int a[10], b[10][10]; |
| 14 |
#pragma acc cache (p[-1:2]) |
| 15 |
; |
| 16 |
#pragma acc cache (q[-1:2][0:10]) |
| 17 |
; |
| 18 |
#pragma acc cache (q[-1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */ |
| 19 |
; |
| 20 |
#pragma acc cache (r[-1:2]) |
| 21 |
; |
| 22 |
#pragma acc cache (s[-1:2][:]) |
| 23 |
; |
| 24 |
#pragma acc cache (s[-1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */ |
| 25 |
; |
| 26 |
#pragma acc cache (a[-1:2]) /* { dg-error "negative low bound in array section in" } */ |
| 27 |
; |
| 28 |
#pragma acc cache (b[-1:2][0:]) /* { dg-error "negative low bound in array section in" } */ |
| 29 |
; |
| 30 |
#pragma acc cache (b[1:2][-2:10]) /* { dg-error "negative low bound in array section in" } */ |
| 31 |
; |
| 32 |
#pragma acc cache (p[2:-3]) /* { dg-error "negative length in array section in" } */ |
| 33 |
; |
| 34 |
#pragma acc cache (q[2:-3][:]) /* { dg-error "negative length in array section in" } */ |
| 35 |
; |
| 36 |
#pragma acc cache (q[2:3][0:-1]) /* { dg-error "negative length in array section in" } */ |
| 37 |
; |
| 38 |
#pragma acc cache (r[2:-5]) /* { dg-error "negative length in array section in" } */ |
| 39 |
; |
| 40 |
#pragma acc cache (s[2:-5][:]) /* { dg-error "negative length in array section in" } */ |
| 41 |
; |
| 42 |
#pragma acc cache (s[2:5][0:-4]) /* { dg-error "negative length in array section in" } */ |
| 43 |
; |
| 44 |
#pragma acc cache (a[2:-5]) /* { dg-error "negative length in array section in" } */ |
| 45 |
; |
| 46 |
#pragma acc cache (b[2:-5][0:10]) /* { dg-error "negative length in array section in" } */ |
| 47 |
; |
| 48 |
#pragma acc cache (b[2:5][0:-4]) /* { dg-error "negative length in array section in" } */ |
| 49 |
; |
| 50 |
} |