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

Ivan Tadeu Ferreira Antunes Filho via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 12:49:57 PDT 2023


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

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

>From 4e1478417dfd72182e9e99f7b6ba109ba6a80232 Mon Sep 17 00:00:00 2001
From: Ivan Tadeu Ferreira Antunes Filho <antunesi at google.com>
Date: Wed, 18 Oct 2023 15:45:30 -0400
Subject: [PATCH] Initialize sigset in asan_interceptors

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 that error
---
 compiler-rt/lib/asan/asan_interceptors.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);



More information about the llvm-commits mailing list