[compiler-rt] Initialize sigset in asan_interceptors (PR #69502)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 12:51:52 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Ivan Tadeu Ferreira Antunes Filho (itf)

<details>
<summary>Changes</summary>

When compiling for Darwin, sigset is not initialized. 

When -Werror,-Wuninitialized-const-reference are enabled we  see the error:
asan_interceptors.cpp:260:38: error: variable 'sigset' is uninitialized when passed as a const reference argument here [-Werror,-Wuninitialized-const-reference] 

This fixes the error

---
Full diff: https://github.com/llvm/llvm-project/pull/69502.diff


1 Files Affected:

- (modified) compiler-rt/lib/asan/asan_interceptors.cpp (+1-1) 


``````````diff
diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp
index fc7c5b7b8fbfade..876682c3b6b3a35 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -251,7 +251,7 @@ INTERCEPTOR(int, pthread_create, void *thread, void *attr,
 
   u32 current_tid = GetCurrentTidOrInvalid();
 
-  __sanitizer_sigset_t sigset;
+  __sanitizer_sigset_t sigset = {};
 #    if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || \
         SANITIZER_SOLARIS
   ScopedBlockSignals block(&sigset);

``````````

</details>


https://github.com/llvm/llvm-project/pull/69502


More information about the llvm-commits mailing list