gcc/
[official-gcc.git] / libgomp / testsuite / libgomp.c / target-9.c
blob4f3c812afd0d785910e4a4cbf644ad3c1f3415ca
1 /* { dg-do run } */
2 /* { dg-options "-O1 -ftree-parallelize-loops=0" } */
3 /* { dg-additional-options "-flto" { target lto } } */
5 #include <stdlib.h>
7 #define N 123456
9 #pragma omp declare target
10 int X, Y;
11 #pragma omp end declare target
13 void
14 foo ()
16 #pragma omp target map(alloc: X)
17 X = N;
20 int
21 main ()
23 int res;
25 foo ();
27 #pragma omp target map(alloc: X, Y) map(from: res)
29 Y = N;
30 res = X + Y;
33 if (res != N + N)
34 abort ();
36 return 0;