[Openmp-commits] [PATCH] D91309: [OpenMP] Fixed a bug when displaying affinity

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Nov 12 07:43:12 PST 2020


tianshilei1992 updated this revision to Diff 304837.
tianshilei1992 added a comment.

Rebased the patch to fix the two failed cases...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91309

Files:
  openmp/runtime/src/kmp_safe_c_api.h
  openmp/runtime/test/affinity/format/simple_env.c


Index: openmp/runtime/test/affinity/format/simple_env.c
===================================================================
--- openmp/runtime/test/affinity/format/simple_env.c
+++ openmp/runtime/test/affinity/format/simple_env.c
@@ -13,4 +13,4 @@
   return 0;
 }
 
-// CHECK-8: num_threads=8 TESTER-ENV: tl:1 tn:[0-7] nt:8
+// CHECK-8: num_threads=8 TESTER-ENV: tl:1 tn:[0-7] nt:8$
Index: openmp/runtime/src/kmp_safe_c_api.h
===================================================================
--- openmp/runtime/src/kmp_safe_c_api.h
+++ openmp/runtime/src/kmp_safe_c_api.h
@@ -64,11 +64,9 @@
                                           char const *src, size_t src_size) {
   if (src_size >= buf_size) {
     src_size = buf_size - 1;
-    KMP_STRNCPY_S(buffer, buf_size, src, src_size);
-    buffer[buf_size - 1] = '\0';
-  } else {
-    KMP_STRNCPY_S(buffer, buf_size, src, src_size);
   }
+  KMP_STRNCPY_S(buffer, buf_size, src, src_size);
+  buffer[src_size] = '\0';
 }
 
 #endif // KMP_SAFE_C_API_H


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91309.304837.patch
Type: text/x-patch
Size: 1002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20201112/1b2a09a7/attachment.bin>


More information about the Openmp-commits mailing list