aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c
diff options
context:
space:
mode:
authorIlya Verbin <ilya.verbin@intel.com>2014-12-10 20:52:10 +0000
committerIlya Verbin <ilya.verbin@intel.com>2014-12-10 20:52:10 +0000
commit718e9a1b734eeff28cb82d91aca558616c35d381 (patch)
tree8841eb668cfea73c85c62faccb4a57c31e68a65a /libgomp/testsuite/libgomp.c
parente34382e82bfc490c7dae58e0304028d9c4a30613 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@218607 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/testsuite/libgomp.c')
-rw-r--r--libgomp/testsuite/libgomp.c/target-9.c37
1 files changed, 37 insertions, 0 deletions
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 <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;
+}