| 1 |
#include <assert.h> |
| 2 |
#include <stdlib.h> |
| 3 |
|
| 4 |
struct str1 { |
| 5 |
int a; |
| 6 |
int b; |
| 7 |
int *c; |
| 8 |
}; |
| 9 |
|
| 10 |
#define N 1024 |
| 11 |
|
| 12 |
int |
| 13 |
main (int argc, char *argv[]) |
| 14 |
{ |
| 15 |
struct str1 s; |
| 16 |
|
| 17 |
s.a = 1; |
| 18 |
s.b = 2; |
| 19 |
s.c = (int *) malloc (sizeof (int) * N); |
| 20 |
|
| 21 |
for (int i = 0; i < N; i++) |
| 22 |
s.c[i] = i + 10; |
| 23 |
|
| 24 |
#pragma acc enter data copyin(s.a, s.b, s.c[0:N]) |
| 25 |
|
| 26 |
#pragma acc serial present(s.a, s.b, s.c[0:N]) /* { dg-warning "using .vector_length \\(32\\)., ignoring 1" "" { target openacc_nvidia_accel_selected } } */ |
| 27 |
{ |
| 28 |
s.a = 3; |
| 29 |
s.b = 4; |
| 30 |
for (int i = 0; i < N; i++) |
| 31 |
s.c[i] = i + 20; |
| 32 |
} |
| 33 |
|
| 34 |
#pragma acc exit data copyout(s.a, s.b, s.c[0:N]) |
| 35 |
|
| 36 |
assert (s.a == 3); |
| 37 |
assert (s.b == 4); |
| 38 |
for (int i = 0; i < N; i++) |
| 39 |
assert (s.c[i] == i + 20); |
| 40 |
|
| 41 |
free (s.c); |
| 42 |
|
| 43 |
return 0; |
| 44 |
} |