[compiler-rt] Fixed build breaking due to #77178 and #86131 (PR #86290)
Abhin P Jose via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 07:56:43 PDT 2024
https://github.com/Abhinkop created https://github.com/llvm/llvm-project/pull/86290
Fixed a small issue of matching pthread signature, which was causing the build to break for the compiler-rt project after adding -Wcast-function-type-mismatch to -Wextra dignostic group.
>From 77cbf17bc515e8e9ba1be557733c78862cb242c7 Mon Sep 17 00:00:00 2001
From: Abhin Parekadan Jose <abhinjose at live.com>
Date: Fri, 22 Mar 2024 15:50:31 +0100
Subject: [PATCH] Fixed a small issue of matching pthread signature
---
compiler-rt/lib/asan/tests/asan_noinst_test.cpp | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/compiler-rt/lib/asan/tests/asan_noinst_test.cpp b/compiler-rt/lib/asan/tests/asan_noinst_test.cpp
index 4c103609c83bfd..df7de2d7d15ed7 100644
--- a/compiler-rt/lib/asan/tests/asan_noinst_test.cpp
+++ b/compiler-rt/lib/asan/tests/asan_noinst_test.cpp
@@ -45,7 +45,8 @@ TEST(AddressSanitizer, InternalSimpleDeathTest) {
EXPECT_DEATH(exit(1), "");
}
-static void MallocStress(size_t n) {
+static void *MallocStress(void *NumOfItrPtr) {
+ size_t n = *((size_t *)NumOfItrPtr);
u32 seed = my_rand();
BufferedStackTrace stack1;
stack1.trace_buffer[0] = 0xa123;
@@ -90,20 +91,21 @@ static void MallocStress(size_t n) {
}
for (size_t i = 0; i < vec.size(); i++)
__asan::asan_free(vec[i], &stack3, __asan::FROM_MALLOC);
+ return nullptr;
}
-
TEST(AddressSanitizer, NoInstMallocTest) {
- MallocStress(ASAN_LOW_MEMORY ? 300000 : 1000000);
+ const size_t kNumIterations = (ASAN_LOW_MEMORY) ? 300000 : 1000000;
+ MallocStress((void *)&kNumIterations);
}
TEST(AddressSanitizer, ThreadedMallocStressTest) {
const int kNumThreads = 4;
- const int kNumIterations = (ASAN_LOW_MEMORY) ? 10000 : 100000;
+ const size_t kNumIterations = (ASAN_LOW_MEMORY) ? 10000 : 100000;
pthread_t t[kNumThreads];
for (int i = 0; i < kNumThreads; i++) {
- PTHREAD_CREATE(&t[i], 0, (void* (*)(void *x))MallocStress,
- (void*)kNumIterations);
+ PTHREAD_CREATE(&t[i], 0, (void *(*)(void *x))MallocStress,
+ (void *)&kNumIterations);
}
for (int i = 0; i < kNumThreads; i++) {
PTHREAD_JOIN(t[i], 0);
More information about the llvm-commits
mailing list