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
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp
@@ -16,7 +16,7 @@
   cpu_set_t set_x;
   int res = pthread_getaffinity_np(pthread_self(), sizeof(set_x), &set_x);
   if (res != 0)
-    printf("res: %d\n", res);
+    fprintf(stderr, "res: %d\n", res);
   assert(res == 0);
   assert(CPU_COUNT_S(sizeof(set_x), &set_x) == get_nprocs());