[Openmp-commits] [PATCH] D146812: [OpenMP][libomptarget][NFC] Make private mapping test more explicit on failure

Gheorghe-Teodor Bercea via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Mar 24 08:05:23 PDT 2023


doru1004 updated this revision to Diff 508100.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146812/new/

https://reviews.llvm.org/D146812

Files:
  openmp/libomptarget/test/mapping/private_mapping.c


Index: openmp/libomptarget/test/mapping/private_mapping.c
===================================================================
--- openmp/libomptarget/test/mapping/private_mapping.c
+++ openmp/libomptarget/test/mapping/private_mapping.c
@@ -4,7 +4,7 @@
 #include <stdio.h>
 
 int main() {
-  int data1[3] = {1}, data2[3] = {2}, data3[3] = {3};
+  int data1[3] = {1}, data2[3] = {2}, data3[3] = {5};
   int sum[16] = {0};
 #pragma omp target teams distribute parallel for map(tofrom : sum)             \
     firstprivate(data1, data2, data3)
@@ -16,9 +16,18 @@
     }
   }
 
+  int correct = 1;
   for (int i = 0; i < 16; ++i) {
-    assert(sum[i] == 6);
+    if (sum[i] != 8) {
+      correct = 0;
+      printf("ERROR: The sum for index %d is %d\n", i, sum[i]);
+      printf("ERROR: data1 = {%d, %d, %d}\n", data1[0], data1[1], data1[2]);
+      printf("ERROR: data2 = {%d, %d, %d}\n", data2[0], data2[1], data2[2]);
+      printf("ERROR: data3 = {%d, %d, %d}\n", data3[0], data3[1], data3[2]);
+      break;
+    }
   }
+  assert(correct);
 
   printf("PASS\n");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146812.508100.patch
Type: text/x-patch
Size: 1068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230324/5147af3c/attachment.bin>


More information about the Openmp-commits mailing list