aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-1.c')
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-1.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-1.c b/libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-1.c
new file mode 100644
index 0000000..f2e7293
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-1.c
@@ -0,0 +1,31 @@
+#ifdef __cplusplus
+extern "C"
+#else
+extern
+#endif
+void abort (void);
+
+int
+main (void)
+{
+ #define N 5
+ int array[N][N];
+
+ for (int i = 0; i < N; i++)
+ {
+ #pragma omp target enter data map(alloc: array[i:1][0:N])
+
+ #pragma omp target
+ for (int j = 0; j < N; j++)
+ array[i][j] = i + j;
+
+ #pragma omp target exit data map(from: array[i:1][0:N])
+ }
+
+ for (int i = 0; i < N; i++)
+ for (int j = 0; j < N; j++)
+ if (array[i][j] != i + j)
+ abort ();
+
+ return 0;
+}