aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c++/target-lambda-1.C
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.c++/target-lambda-1.C')
-rw-r--r--libgomp/testsuite/libgomp.c++/target-lambda-1.C15
1 files changed, 11 insertions, 4 deletions
diff --git a/libgomp/testsuite/libgomp.c++/target-lambda-1.C b/libgomp/testsuite/libgomp.c++/target-lambda-1.C
index fa882d0..6eb0d0b 100644
--- a/libgomp/testsuite/libgomp.c++/target-lambda-1.C
+++ b/libgomp/testsuite/libgomp.c++/target-lambda-1.C
@@ -1,4 +1,4 @@
-// { dg-do run { target offload_device_nonshared_as } }
+// { dg-do run }
#include <cstdlib>
#include <cstring>
@@ -48,7 +48,11 @@ int main (void)
int *data1 = new int[N];
int *data2 = new int[N];
memset (data1, 0xab, sizeof (int) * N);
- memset (data1, 0xcd, sizeof (int) * N);
+ memset (data2, 0xcd, sizeof (int) * N);
+
+ bool shared_mem = false;
+ #pragma omp target map(to: shared_mem)
+ shared_mem = true;
int val = 1;
int &valref = val;
@@ -77,13 +81,16 @@ int main (void)
if (f ()) abort ();
#pragma omp target enter data map(to: data2[:N])
- if (!f ()) abort ();
+ if (!f () && !shared_mem) abort ();
#pragma omp target exit data map(from: data1[:N], data2[:N])
+ if (!shared_mem)
for (int i = 0; i < N; i++)
{
- if (data1[i] != 0xf) abort ();
+ /* With shared memory, data1 is not modified inside 'f'
+ as mapped = false. */
+ if (!shared_mem && data1[i] != 0xf) abort ();
if (data2[i] != 2) abort ();
}