1 /* { dg-do run } */ 2 /* { dg-options "-O1 -ftree-parallelize-loops=0" } */ 3 /* { dg-additional-options "-flto" { target lto } } */ 4 5 #include <stdlib.h> 6 7 #define N 123456 8 9 #pragma omp declare target 10 int X, Y; 11 #pragma omp end declare target 12 13 void foo()14foo () 15 { 16 #pragma omp target map(alloc: X) 17 X = N; 18 } 19 20 int main()21main () 22 { 23 int res; 24 25 foo (); 26 27 #pragma omp target map(alloc: X, Y) map(from: res) 28 { 29 Y = N; 30 res = X + Y; 31 } 32 33 if (res != N + N) 34 abort (); 35 36 return 0; 37 } 38