comparison libgomp/testsuite/libgomp.c/pr64734.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* PR middle-end/64734 */
2
3 #include <stdlib.h>
4
5 void
6 foo (int *x, int *y)
7 {
8 #pragma omp target map (alloc:x[0]) map (alloc:y[0:8])
9 {
10 int i;
11 for (i = 0; i < 8; i++)
12 if (y[i] != 2 + i)
13 break;
14 if (i != 8 || *x != 1)
15 *x = 6;
16 else
17 {
18 *x = 8;
19 for (i = 0; i < 8; i++)
20 y[i] = 9 + i;
21 }
22 }
23 #pragma omp target update from (y[0:8]) from (x[0])
24 }
25
26 void
27 bar (void)
28 {
29 int x = 1, y[32] = { 0 };
30 #pragma omp target data map (to:y[0:32]) map (to:x)
31 ;
32 }
33
34 int
35 main ()
36 {
37 int x = 1, y[8] = { 2, 3, 4, 5, 6, 7, 8, 9 }, i;
38 #pragma omp target data map (to:y[0:8]) map (to:x)
39 ;
40 #pragma omp target data map (to:y[0:8]) map (to:x)
41 {
42 #pragma omp target update from (y[0:8]) from (x)
43 }
44
45 #pragma omp target data map (to:y[0:8]) map (to:x)
46 foo (&x, &y[0]);
47
48 if (x != 8)
49 abort ();
50 for (i = 0; i < 8; i++)
51 if (y[i] != 9 + i)
52 abort ();
53
54 return 0;
55 }