[Openmp-commits] [PATCH] D149623: [OpenMP] Fix libomptarget test mapping/ompx_hold/struct.c
Joel E. Denny via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue May 2 12:40:13 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3a1e06e0e82c: [OpenMP] Fix libomptarget test mapping/ompx_hold/struct.c (authored by jdenny).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149623/new/
https://reviews.llvm.org/D149623
Files:
openmp/libomptarget/test/mapping/ompx_hold/struct.c
Index: openmp/libomptarget/test/mapping/ompx_hold/struct.c
===================================================================
--- openmp/libomptarget/test/mapping/ompx_hold/struct.c
+++ openmp/libomptarget/test/mapping/ompx_hold/struct.c
@@ -5,9 +5,16 @@
#include <stdio.h>
#pragma omp begin declare target
-char *N1, *N2;
+#define MAX_NAME_SIZE 100
+char N1[MAX_NAME_SIZE], N2[MAX_NAME_SIZE];
int V1, V2;
-#pragma omp declare target
+void copy_name(char *dst, char *src) {
+ int i;
+ for (i = 0; i < MAX_NAME_SIZE - 1 && src[i]; ++i)
+ dst[i] = src[i];
+ dst[i] = 0;
+}
+#pragma omp end declare target
#define CHECK_PRESENCE(Var1, Var2, Var3) \
printf(" presence of %s, %s, %s: %d, %d, %d\n", #Var1, #Var2, #Var3, \
@@ -19,12 +26,12 @@
printf(" values of %s, %s: %d, %d\n", N1, N2, (Var1), (Var2))
#define CHECK_VALUES_DELAYED(Var1, Var2) \
- N1 = #Var1; \
- N2 = #Var2; \
+ copy_name(N1, #Var1); \
+ copy_name(N2, #Var2); \
V1 = (Var1); \
V2 = (Var2);
-#define CHECK_DELAYED_VALUS() \
+#define CHECK_DELAYED_VALUES() \
_Pragma("omp target update from(N1, N2, V1, V2)") \
CHECK_VALUES_HELPER(N1, N2, V1, V2)
@@ -149,7 +156,7 @@
// CHECK-NEXT: values of s.i, s.j: 21, 31
CHECK_VALUES_DELAYED(s.i, s.j);
}
- CHECK_DELAYED_VALUS();
+ CHECK_DELAYED_VALUES();
}
// CHECK-NEXT: presence of s, s.i, s.j: 0, 0, 0
// CHECK-NEXT: values of s.i, s.j: 21, 31
@@ -180,7 +187,7 @@
// CHECK-NEXT: values of s.i, s.j: 21, 31
CHECK_VALUES_DELAYED(s.i, s.j);
}
- CHECK_DELAYED_VALUS();
+ CHECK_DELAYED_VALUES();
}
// CHECK-NEXT: presence of s, s.i, s.j: 0, 0, 0
// CHECK-NEXT: values of s.i, s.j: 21, 31
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149623.518832.patch
Type: text/x-patch
Size: 2218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230502/77b50283/attachment.bin>
More information about the Openmp-commits
mailing list