OpenMP/OpenACC: Unordered/non-constant component offset runtime diagnostic
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / map-arrayofstruct-2.c
blobff7ce0eb162288570d102684aab9916500665a89
1 #include <stdlib.h>
2 #include <assert.h>
4 struct st {
5 int *p;
6 };
8 int main (void)
10 struct st s[10];
12 for (int i = 0; i < 10; i++)
13 s[i].p = (int *) calloc (5, sizeof (int));
15 for (int i = 0; i < 10; i++)
16 for (int j = 0; j < 10; j++)
17 for (int k = 0; k < 10; k++)
19 if (i == j || j == k || i == k)
20 continue;
22 #pragma omp target map(s[i].p, s[j].p, s[k].p, s[i].p[0:2], s[j].p[1:3], \
23 s[k].p[2])
25 s[i].p[0]++;
26 s[j].p[1]++;
27 s[k].p[2]++;
30 #pragma omp target map(s, s[i].p[0:2], s[j].p[1:3], s[k].p[2])
32 s[i].p[0]++;
33 s[j].p[1]++;
34 s[k].p[2]++;
37 #pragma omp target map(s[0:10], s[i].p[0:2], s[j].p[1:3], s[k].p[2])
39 s[i].p[0]++;
40 s[j].p[1]++;
41 s[k].p[2]++;
45 for (int i = 0; i < 10; i++)
47 assert (s[i].p[0] == 216);
48 assert (s[i].p[1] == 216);
49 assert (s[i].p[2] == 216);
50 free (s[i].p);
53 return 0;
56 /* { dg-output "(\n|\r|\r\n)" { target offload_device_nonshared_as } } */
57 /* { dg-output "libgomp: Mapped array elements must be the same .*(\n|\r|\r\n)+" { target offload_device_nonshared_as } } */
58 /* { dg-shouldfail "" { offload_device_nonshared_as } } */