aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c')
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c b/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c
new file mode 100644
index 00000000000..bc4b916e9a4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c
@@ -0,0 +1,19 @@
+/* { dg-do link } */
+/* { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" { target offload_device_nonshared_as } } */
+
+int var; /* { dg-error "variable 'var' has been referenced in offloaded code but hasn't been marked to be included in the offloaded code" "" { target offload_device_nonshared_as } } */
+
+#pragma omp declare target
+void __attribute__((noinline, noclone))
+foo (void)
+{
+ var++;
+}
+#pragma omp end declare target
+
+int
+main ()
+{
+#pragma omp target
+ foo ();
+}