[compiler-rt] 0777be6 - [MSAN] print out the only possible invalid parameter (EINVAL is returned)

Kevin Athey via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 16:23:07 PDT 2022


Author: Kevin Athey
Date: 2022-06-08T16:23:04-07:00
New Revision: 0777be69fba99d90ef7466c8aa986ef17ee3d110

URL: https://github.com/llvm/llvm-project/commit/0777be69fba99d90ef7466c8aa986ef17ee3d110
DIFF: https://github.com/llvm/llvm-project/commit/0777be69fba99d90ef7466c8aa986ef17ee3d110.diff

LOG: [MSAN] print out the only possible invalid parameter (EINVAL is returned)

One more round attempting to figure what is wrong.

Depends on: https://reviews.llvm.org/D127346

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D127359

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp
index cdff7ced8898d..49c40d3287bc4 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp
@@ -5,6 +5,10 @@
 // sched_getaffinity).
 // UNSUPPORTED: android
 
+#ifndef _GNU_SOURCE
+#  define _GNU_SOURCE
+#endif
+
 #include <assert.h>
 #include <pthread.h>
 #include <stdio.h>
@@ -14,9 +18,13 @@
 
 int main() {
   cpu_set_t set_x;
-  int res = pthread_getaffinity_np(pthread_self(), sizeof(set_x), &set_x);
-  if (res != 0)
+  pthread_t tid = pthread_self();
+  int res = pthread_getaffinity_np(tid, sizeof(set_x), &set_x);
+  if (res != 0) {
+    fprintf(stderr, "tid: %lu\n", tid);
+    fprintf(stderr, "sizeof(set_x): %d\n", sizeof(set_x));
     fprintf(stderr, "res: %d\n", res);
+  }
   assert(res == 0);
   assert(CPU_COUNT_S(sizeof(set_x), &set_x) == get_nprocs());
 


        


More information about the llvm-commits mailing list