Skip to content

Commit

Permalink
Fixed build breaking due to llvm#77178 and llvm#86131 (llvm#86290)
Browse files Browse the repository at this point in the history
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
(llvm#77178 &
llvm#86131).
  • Loading branch information
Abhinkop authored Mar 22, 2024
1 parent 8155ec1 commit 7269570
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions compiler-rt/lib/asan/tests/asan_noinst_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7269570

Please sign in to comment.