diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5ffca8465f6..6befea5041c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-12-10 Ilya Verbin + + * varpool.c (varpool_node::get_create): Force output of vars with + "omp declare target" attribute. + 2014-12-10 Marc Glisse * real.h (HONOR_NANS): Replace macro with 3 overloaded declarations. diff --git a/gcc/varpool.c b/gcc/varpool.c index 0526b7f195e..db28c2acd90 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -175,6 +175,7 @@ varpool_node::get_create (tree decl) g->have_offload = true; if (!in_lto_p) vec_safe_push (offload_vars, decl); + node->force_output = 1; #endif } diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index acf45fb00af..8d8b8d8d6ec 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,7 @@ +2014-12-10 Ilya Verbin + + * testsuite/libgomp.c/target-9.c: New test. + 2014-12-09 Varvara Rainchik * config.h.in: Regenerate. diff --git a/libgomp/testsuite/libgomp.c/target-9.c b/libgomp/testsuite/libgomp.c/target-9.c new file mode 100644 index 00000000000..00fe0cb1702 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-9.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-options "-O1" } */ +/* { dg-additional-options "-flto" { target lto } } */ + +#include + +#define N 123456 + +#pragma omp declare target +int X, Y; +#pragma omp end declare target + +void +foo () +{ + #pragma omp target map(alloc: X) + X = N; +} + +int +main () +{ + int res; + + foo (); + + #pragma omp target map(alloc: X, Y) map(from: res) + { + Y = N; + res = X + Y; + } + + if (res != N + N) + abort (); + + return 0; +}