[compiler-rt] 5e5cce5 - [NFC] [sanitizers] leave BufferedStackTrace uninit in tests

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 15:19:55 PDT 2024


Author: Florian Mayer
Date: 2024-08-07T15:19:28-07:00
New Revision: 5e5cce5643bdfdb27faf9cb48f75a3f2afe0993e

URL: https://github.com/llvm/llvm-project/commit/5e5cce5643bdfdb27faf9cb48f75a3f2afe0993e
DIFF: https://github.com/llvm/llvm-project/commit/5e5cce5643bdfdb27faf9cb48f75a3f2afe0993e.diff

LOG: [NFC] [sanitizers] leave BufferedStackTrace uninit in tests

This is for consistency with the production code

Pull Request: https://github.com/llvm/llvm-project/pull/102251

Added: 
    

Modified: 
    compiler-rt/lib/asan/tests/asan_noinst_test.cpp
    compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/tests/asan_noinst_test.cpp b/compiler-rt/lib/asan/tests/asan_noinst_test.cpp
index df7de2d7d15ed..ba1eab1a90f44 100644
--- a/compiler-rt/lib/asan/tests/asan_noinst_test.cpp
+++ b/compiler-rt/lib/asan/tests/asan_noinst_test.cpp
@@ -137,7 +137,7 @@ TEST(AddressSanitizer, DISABLED_InternalPrintShadow) {
 }
 
 TEST(AddressSanitizer, QuarantineTest) {
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   stack.trace_buffer[0] = 0x890;
   stack.size = 1;
 
@@ -159,7 +159,7 @@ TEST(AddressSanitizer, QuarantineTest) {
 void *ThreadedQuarantineTestWorker(void *unused) {
   (void)unused;
   u32 seed = my_rand();
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   stack.trace_buffer[0] = 0x890;
   stack.size = 1;
 
@@ -194,7 +194,7 @@ TEST(AddressSanitizer, ThreadedQuarantineTest) {
 
 void *ThreadedOneSizeMallocStress(void *unused) {
   (void)unused;
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   stack.trace_buffer[0] = 0x890;
   stack.size = 1;
   const size_t kNumMallocs = 1000;
@@ -238,7 +238,7 @@ static void TestLoadStoreCallbacks(CB cb[2][5]) {
   uptr buggy_ptr;
 
   __asan_test_only_reported_buggy_pointer = &buggy_ptr;
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   stack.trace_buffer[0] = 0x890;
   stack.size = 1;
 

diff  --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp
index 11ca1fd7f0517..cf42294a4b0c3 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp
@@ -259,7 +259,7 @@ TEST_F(StackPrintDeathTest, SKIP_ON_SPARC(RequiresNonNullBuffer)) {
 #endif // SANITIZER_CAN_FAST_UNWIND
 
 TEST(SlowUnwindTest, ShortStackTrace) {
-  BufferedStackTrace stack;
+  UNINITIALIZED BufferedStackTrace stack;
   uptr pc = StackTrace::GetCurrentPc();
   uptr bp = GET_CURRENT_FRAME();
   stack.Unwind(pc, bp, nullptr, false, /*max_depth=*/0);


        


More information about the llvm-commits mailing list