[compiler-rt] cda72e9 - [msan] Fix test with GLIBC 2.34
via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 14 20:15:49 PST 2021
Author: Vitaly Buka
Date: 2021-11-14T20:15:45-08:00
New Revision: cda72e92971bc8b4e88f89fd01e18ee55376b84f
URL: https://github.com/llvm/llvm-project/commit/cda72e92971bc8b4e88f89fd01e18ee55376b84f
DIFF: https://github.com/llvm/llvm-project/commit/cda72e92971bc8b4e88f89fd01e18ee55376b84f.diff
LOG: [msan] Fix test with GLIBC 2.34
PTHREAD_STACK_MIN is not a constexpr
Added:
Modified:
compiler-rt/lib/msan/tests/msan_test.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/msan/tests/msan_test.cpp b/compiler-rt/lib/msan/tests/msan_test.cpp
index 81794361213f5..2916c637e6ead 100644
--- a/compiler-rt/lib/msan/tests/msan_test.cpp
+++ b/compiler-rt/lib/msan/tests/msan_test.cpp
@@ -3280,11 +3280,13 @@ static void *SmallStackThread_threadfn(void* data) {
return 0;
}
+static int GetThreadStackMin() {
#ifdef PTHREAD_STACK_MIN
-constexpr int kThreadStackMin = PTHREAD_STACK_MIN;
+ return PTHREAD_STACK_MIN;
#else
-constexpr int kThreadStackMin = 0;
+ return 0;
#endif
+}
TEST(MemorySanitizer, SmallStackThread) {
pthread_attr_t attr;
@@ -3293,7 +3295,7 @@ TEST(MemorySanitizer, SmallStackThread) {
int res;
res = pthread_attr_init(&attr);
ASSERT_EQ(0, res);
- res = pthread_attr_setstacksize(&attr, std::max(kThreadStackMin, 64 * 1024));
+ res = pthread_attr_setstacksize(&attr, std::max(GetThreadStackMin(), 64 * 1024));
ASSERT_EQ(0, res);
res = pthread_create(&t, &attr, SmallStackThread_threadfn, NULL);
ASSERT_EQ(0, res);
@@ -3310,7 +3312,7 @@ TEST(MemorySanitizer, SmallPreAllocatedStackThread) {
res = pthread_attr_init(&attr);
ASSERT_EQ(0, res);
void *stack;
- const size_t kStackSize = std::max(kThreadStackMin, 32 * 1024);
+ const size_t kStackSize = std::max(GetThreadStackMin(), 32 * 1024);
res = posix_memalign(&stack, 4096, kStackSize);
ASSERT_EQ(0, res);
res = pthread_attr_setstack(&attr, stack, kStackSize);
More information about the llvm-commits
mailing list