* c-c++-common/Wrestrict.c (test_strcpy_range): Revert latest change.
[official-gcc.git] / libgomp / testsuite / libgomp.c / target-22.c
blobaad8a0a09df70349aa909c5a53a64811cf5757a1
1 extern void abort (void);
2 struct T { int a; int *b; int c; };
3 struct S { int *s; char *u; struct T v; short *w; };
4 volatile int z;
6 int
7 main ()
9 struct S s;
10 int a[32], i;
11 char b[32];
12 short c[32];
13 for (i = 0; i < 32; i++)
15 a[i] = i;
16 b[i] = 32 + i;
17 c[i] = 64 + i;
19 s.s = a;
20 s.u = b + 2;
21 s.v.b = a + 16;
22 s.w = c + 3;
23 int err = 0;
24 #pragma omp target map (to:s.v.b[0:z + 7], s.u[z + 1:z + 4]) \
25 map (tofrom:s.s[3:3]) \
26 map (from: s.w[z:4], err) private (i)
28 err = 0;
29 for (i = 0; i < 7; i++)
30 if (s.v.b[i] != 16 + i)
31 err = 1;
32 for (i = 1; i < 5; i++)
33 if (s.u[i] != 34 + i)
34 err = 1;
35 for (i = 3; i < 6; i++)
36 if (s.s[i] != i)
37 err = 1;
38 else
39 s.s[i] = 128 + i;
40 for (i = 0; i < 4; i++)
41 s.w[i] = 96 + i;
43 if (err)
44 abort ();
45 for (i = 0; i < 32; i++)
46 if (a[i] != ((i >= 3 && i < 6) ? 128 + i : i)
47 || b[i] != 32 + i
48 || c[i] != ((i >= 3 && i < 7) ? 93 + i : 64 + i))
49 abort ();
50 return 0;