Force output of vars with "omp declare target" attribute in gcc/varpool.c

gcc/
	* varpool.c (varpool_node::get_create): Force output of vars with
	"omp declare target" attribute.
libgomp/
	* testsuite/libgomp.c/target-9.c: New test.

From-SVN: r218607
This commit is contained in:
Ilya Verbin 2014-12-10 20:52:10 +00:00 committed by Ilya Verbin
parent c44f74e4cb
commit 2354caecd9
4 changed files with 47 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2014-12-10 Ilya Verbin <ilya.verbin@intel.com>
* varpool.c (varpool_node::get_create): Force output of vars with
"omp declare target" attribute.
2014-12-10 Marc Glisse <marc.glisse@inria.fr>
* real.h (HONOR_NANS): Replace macro with 3 overloaded declarations.

View File

@ -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
}

View File

@ -1,3 +1,7 @@
2014-12-10 Ilya Verbin <ilya.verbin@intel.com>
* testsuite/libgomp.c/target-9.c: New test.
2014-12-09 Varvara Rainchik <varvara.rainchik@intel.com>
* config.h.in: Regenerate.

View File

@ -0,0 +1,37 @@
/* { dg-do run } */
/* { dg-options "-O1" } */
/* { dg-additional-options "-flto" { target lto } } */
#include <stdlib.h>
#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;
}