This is an archive of the discontinued LLVM Phabricator instance.

sanitizer: fix GCC warnings
AbandonedPublic

Authored by marxin on Nov 15 2022, 8:16 AM.

Details

Summary

Fixes the following GCC warnings:

sanitizer_common/sanitizer_posix.cpp:165:27: warning: ‘flags’ may be used uninitialized [-Wmaybe-uninitialized]
sanitizer_common/sanitizer_stack_store.cpp:192:17: warning: ‘diff’ may be used uninitialized [-Wmaybe-uninitialized]
asan/asan_interceptors_memintrinsics.h:57:10: warning: ‘local_iovec.__sanitizer::__sanitizer_iovec::iov_base’ may be used uninitialized [-Wmaybe-uninitialized]
tsan/tsan_dense_alloc.h:165:46: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
ubsan/ubsan_diag.h:193:21: warning: ‘CheckKindStr’ may be used uninitialized [-Wmaybe-uninitialized]
tsan/tsan_rtl.h:739:3: warning: ‘evp’ may be used uninitialized [-Wmaybe-uninitialized]
tsan/tsan_rtl.h:728:52: warning: ‘evp’ may be used uninitialized [-Wmaybe-uninitialized]
sanitizer_common/sanitizer_common_interceptors.inc:3509:21: warning: ‘local_iovec.__sanitizer::__sanitizer_iovec::iov_len’ may be used uninitialized [-Wmaybe-uninitialized]

Diff Detail

Event Timeline

marxin created this revision.Nov 15 2022, 8:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 15 2022, 8:16 AM
Herald added a subscriber: Enna1. · View Herald Transcript
marxin requested review of this revision.Nov 15 2022, 8:16 AM
marxin edited the summary of this revision. (Show Details)
MaskRay requested changes to this revision.EditedNov 25 2022, 7:51 PM

Sorry, llvm-project considers that GCC -Wmaybe-uninitialized introduces too much false positive and doesn't use it. (See USE_NO_MAYBE_UNINITIALIZED.)
I have checked most call sites and think the changes will add unnecessary runtime overhead / harm readability (as the user cannot know that a function call has a write-only parameter and will guarantee to initialize the variable).

compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h
165

The new code changes semantics and likely introduces a bug...

This revision now requires changes to proceed.Nov 25 2022, 7:51 PM
marxin abandoned this revision.Nov 28 2022, 6:26 AM

Fair enough, then let's discard this.