diff --git a/compiler-rt/lib/asan/asan_activation.cpp b/compiler-rt/lib/asan/asan_activation.cpp --- a/compiler-rt/lib/asan/asan_activation.cpp +++ b/compiler-rt/lib/asan/asan_activation.cpp @@ -44,7 +44,7 @@ void OverrideFromActivationFlags() { Flags f; - CommonFlags cf; + UNINITIALIZED CommonFlags cf; FlagParser parser; RegisterActivationFlags(&parser, &f, &cf); diff --git a/compiler-rt/lib/asan/asan_debugging.cpp b/compiler-rt/lib/asan/asan_debugging.cpp --- a/compiler-rt/lib/asan/asan_debugging.cpp +++ b/compiler-rt/lib/asan/asan_debugging.cpp @@ -80,7 +80,7 @@ const char *__asan_locate_address(uptr addr, char *name, uptr name_size, uptr *region_address_ptr, uptr *region_size_ptr) { - AddressDescription descr(addr); + UNINITIALIZED AddressDescription descr(addr); uptr region_address = 0; uptr region_size = 0; const char *region_kind = nullptr; diff --git a/compiler-rt/lib/asan/asan_descriptions.cpp b/compiler-rt/lib/asan/asan_descriptions.cpp --- a/compiler-rt/lib/asan/asan_descriptions.cpp +++ b/compiler-rt/lib/asan/asan_descriptions.cpp @@ -310,7 +310,7 @@ bool DescribeAddressIfGlobal(uptr addr, uptr access_size, const char *bug_type) { - GlobalAddressDescription descr; + UNINITIALIZED GlobalAddressDescription descr; if (!GetGlobalAddressInformation(addr, access_size, &descr)) return false; descr.Print(bug_type); @@ -481,7 +481,7 @@ return; } - GlobalAddressDescription global_descr; + UNINITIALIZED GlobalAddressDescription global_descr; if (GetGlobalAddressInformation(addr, access_size, &global_descr)) { global_descr.Print(bug_type); return; diff --git a/compiler-rt/lib/asan/asan_flags.cpp b/compiler-rt/lib/asan/asan_flags.cpp --- a/compiler-rt/lib/asan/asan_flags.cpp +++ b/compiler-rt/lib/asan/asan_flags.cpp @@ -51,7 +51,7 @@ // Set the default values and prepare for parsing ASan and common flags. SetCommonFlagsDefaults(); { - CommonFlags cf; + UNINITIALIZED CommonFlags cf; cf.CopyFrom(*common_flags()); cf.detect_leaks = cf.detect_leaks && CAN_SANITIZE_LEAKS; cf.external_symbolizer_path = GetEnv("ASAN_SYMBOLIZER_PATH"); diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp --- a/compiler-rt/lib/asan/asan_interceptors.cpp +++ b/compiler-rt/lib/asan/asan_interceptors.cpp @@ -315,7 +315,7 @@ INTERCEPTOR(void, makecontext, struct ucontext_t *ucp, void (*func)(), int argc, ...) { va_list ap; - uptr args[64]; + UNINITIALIZED uptr args[64]; // We don't know a better way to forward ... into REAL function. We can // increase args size if neccecary. CHECK_LE(argc, ARRAY_SIZE(args)); diff --git a/compiler-rt/lib/asan/asan_linux.cpp b/compiler-rt/lib/asan/asan_linux.cpp --- a/compiler-rt/lib/asan/asan_linux.cpp +++ b/compiler-rt/lib/asan/asan_linux.cpp @@ -193,7 +193,7 @@ // the functions in dynamic ASan runtime instead of the functions in // system libraries, causing crashes later in ASan initialization. MemoryMappingLayout proc_maps(/*cache_enabled*/ true); - char filename[PATH_MAX]; + UNINITIALIZED char filename[PATH_MAX]; MemoryMappedSegment segment(filename, sizeof(filename)); while (proc_maps.Next(&segment)) { if (IsDynamicRTName(segment.filename)) { diff --git a/compiler-rt/lib/asan/asan_report.cpp b/compiler-rt/lib/asan/asan_report.cpp --- a/compiler-rt/lib/asan/asan_report.cpp +++ b/compiler-rt/lib/asan/asan_report.cpp @@ -215,13 +215,14 @@ void ReportDeadlySignal(const SignalContext &sig) { ScopedInErrorReport in_report(/*fatal*/ true); - ErrorDeadlySignal error(GetCurrentTidOrInvalid(), sig); + UNINITIALIZED ErrorDeadlySignal error(GetCurrentTidOrInvalid(), sig); in_report.ReportError(error); } void ReportDoubleFree(uptr addr, BufferedStackTrace *free_stack) { ScopedInErrorReport in_report; - ErrorDoubleFree error(GetCurrentTidOrInvalid(), free_stack, addr); + UNINITIALIZED ErrorDoubleFree error(GetCurrentTidOrInvalid(), free_stack, + addr); in_report.ReportError(error); } @@ -229,14 +230,16 @@ uptr delete_alignment, BufferedStackTrace *free_stack) { ScopedInErrorReport in_report; - ErrorNewDeleteTypeMismatch error(GetCurrentTidOrInvalid(), free_stack, addr, - delete_size, delete_alignment); + UNINITIALIZED ErrorNewDeleteTypeMismatch error(GetCurrentTidOrInvalid(), + free_stack, addr, delete_size, + delete_alignment); in_report.ReportError(error); } void ReportFreeNotMalloced(uptr addr, BufferedStackTrace *free_stack) { ScopedInErrorReport in_report; - ErrorFreeNotMalloced error(GetCurrentTidOrInvalid(), free_stack, addr); + UNINITIALIZED ErrorFreeNotMalloced error(GetCurrentTidOrInvalid(), free_stack, + addr); in_report.ReportError(error); } @@ -244,85 +247,90 @@ AllocType alloc_type, AllocType dealloc_type) { ScopedInErrorReport in_report; - ErrorAllocTypeMismatch error(GetCurrentTidOrInvalid(), free_stack, addr, - alloc_type, dealloc_type); + UNINITIALIZED ErrorAllocTypeMismatch error( + GetCurrentTidOrInvalid(), free_stack, addr, alloc_type, dealloc_type); in_report.ReportError(error); } void ReportMallocUsableSizeNotOwned(uptr addr, BufferedStackTrace *stack) { ScopedInErrorReport in_report; - ErrorMallocUsableSizeNotOwned error(GetCurrentTidOrInvalid(), stack, addr); + UNINITIALIZED ErrorMallocUsableSizeNotOwned error(GetCurrentTidOrInvalid(), + stack, addr); in_report.ReportError(error); } void ReportSanitizerGetAllocatedSizeNotOwned(uptr addr, BufferedStackTrace *stack) { ScopedInErrorReport in_report; - ErrorSanitizerGetAllocatedSizeNotOwned error(GetCurrentTidOrInvalid(), stack, - addr); + UNINITIALIZED ErrorSanitizerGetAllocatedSizeNotOwned error( + GetCurrentTidOrInvalid(), stack, addr); in_report.ReportError(error); } void ReportCallocOverflow(uptr count, uptr size, BufferedStackTrace *stack) { ScopedInErrorReport in_report(/*fatal*/ true); - ErrorCallocOverflow error(GetCurrentTidOrInvalid(), stack, count, size); + UNINITIALIZED ErrorCallocOverflow error(GetCurrentTidOrInvalid(), stack, + count, size); in_report.ReportError(error); } void ReportReallocArrayOverflow(uptr count, uptr size, BufferedStackTrace *stack) { ScopedInErrorReport in_report(/*fatal*/ true); - ErrorReallocArrayOverflow error(GetCurrentTidOrInvalid(), stack, count, size); + UNINITIALIZED ErrorReallocArrayOverflow error(GetCurrentTidOrInvalid(), stack, + count, size); in_report.ReportError(error); } void ReportPvallocOverflow(uptr size, BufferedStackTrace *stack) { ScopedInErrorReport in_report(/*fatal*/ true); - ErrorPvallocOverflow error(GetCurrentTidOrInvalid(), stack, size); + UNINITIALIZED ErrorPvallocOverflow error(GetCurrentTidOrInvalid(), stack, + size); in_report.ReportError(error); } void ReportInvalidAllocationAlignment(uptr alignment, BufferedStackTrace *stack) { ScopedInErrorReport in_report(/*fatal*/ true); - ErrorInvalidAllocationAlignment error(GetCurrentTidOrInvalid(), stack, - alignment); + UNINITIALIZED ErrorInvalidAllocationAlignment error(GetCurrentTidOrInvalid(), + stack, alignment); in_report.ReportError(error); } void ReportInvalidAlignedAllocAlignment(uptr size, uptr alignment, BufferedStackTrace *stack) { ScopedInErrorReport in_report(/*fatal*/ true); - ErrorInvalidAlignedAllocAlignment error(GetCurrentTidOrInvalid(), stack, - size, alignment); + UNINITIALIZED ErrorInvalidAlignedAllocAlignment error( + GetCurrentTidOrInvalid(), stack, size, alignment); in_report.ReportError(error); } void ReportInvalidPosixMemalignAlignment(uptr alignment, BufferedStackTrace *stack) { ScopedInErrorReport in_report(/*fatal*/ true); - ErrorInvalidPosixMemalignAlignment error(GetCurrentTidOrInvalid(), stack, - alignment); + UNINITIALIZED ErrorInvalidPosixMemalignAlignment error( + GetCurrentTidOrInvalid(), stack, alignment); in_report.ReportError(error); } void ReportAllocationSizeTooBig(uptr user_size, uptr total_size, uptr max_size, BufferedStackTrace *stack) { ScopedInErrorReport in_report(/*fatal*/ true); - ErrorAllocationSizeTooBig error(GetCurrentTidOrInvalid(), stack, user_size, - total_size, max_size); + UNINITIALIZED ErrorAllocationSizeTooBig error( + GetCurrentTidOrInvalid(), stack, user_size, total_size, max_size); in_report.ReportError(error); } void ReportRssLimitExceeded(BufferedStackTrace *stack) { ScopedInErrorReport in_report(/*fatal*/ true); - ErrorRssLimitExceeded error(GetCurrentTidOrInvalid(), stack); + UNINITIALIZED ErrorRssLimitExceeded error(GetCurrentTidOrInvalid(), stack); in_report.ReportError(error); } void ReportOutOfMemory(uptr requested_size, BufferedStackTrace *stack) { ScopedInErrorReport in_report(/*fatal*/ true); - ErrorOutOfMemory error(GetCurrentTidOrInvalid(), stack, requested_size); + UNINITIALIZED ErrorOutOfMemory error(GetCurrentTidOrInvalid(), stack, + requested_size); in_report.ReportError(error); } @@ -331,7 +339,7 @@ const char *offset2, uptr length2, BufferedStackTrace *stack) { ScopedInErrorReport in_report; - ErrorStringFunctionMemoryRangesOverlap error( + UNINITIALIZED ErrorStringFunctionMemoryRangesOverlap error( GetCurrentTidOrInvalid(), stack, (uptr)offset1, length1, (uptr)offset2, length2, function); in_report.ReportError(error); @@ -340,8 +348,8 @@ void ReportStringFunctionSizeOverflow(uptr offset, uptr size, BufferedStackTrace *stack) { ScopedInErrorReport in_report; - ErrorStringFunctionSizeOverflow error(GetCurrentTidOrInvalid(), stack, offset, - size); + UNINITIALIZED ErrorStringFunctionSizeOverflow error(GetCurrentTidOrInvalid(), + stack, offset, size); in_report.ReportError(error); } @@ -349,7 +357,7 @@ uptr old_mid, uptr new_mid, BufferedStackTrace *stack) { ScopedInErrorReport in_report; - ErrorBadParamsToAnnotateContiguousContainer error( + UNINITIALIZED ErrorBadParamsToAnnotateContiguousContainer error( GetCurrentTidOrInvalid(), stack, beg, end, old_mid, new_mid); in_report.ReportError(error); } @@ -359,7 +367,7 @@ uptr old_container_end, uptr new_container_beg, uptr new_container_end, BufferedStackTrace *stack) { ScopedInErrorReport in_report; - ErrorBadParamsToAnnotateDoubleEndedContiguousContainer error( + UNINITIALIZED ErrorBadParamsToAnnotateDoubleEndedContiguousContainer error( GetCurrentTidOrInvalid(), stack, storage_beg, storage_end, old_container_beg, old_container_end, new_container_beg, new_container_end); @@ -369,8 +377,8 @@ void ReportODRViolation(const __asan_global *g1, u32 stack_id1, const __asan_global *g2, u32 stack_id2) { ScopedInErrorReport in_report; - ErrorODRViolation error(GetCurrentTidOrInvalid(), g1, stack_id1, g2, - stack_id2); + UNINITIALIZED ErrorODRViolation error(GetCurrentTidOrInvalid(), g1, stack_id1, + g2, stack_id2); in_report.ReportError(error); } @@ -378,7 +386,8 @@ static NOINLINE void ReportInvalidPointerPair(uptr pc, uptr bp, uptr sp, uptr a1, uptr a2) { ScopedInErrorReport in_report; - ErrorInvalidPointerPair error(GetCurrentTidOrInvalid(), pc, bp, sp, a1, a2); + UNINITIALIZED ErrorInvalidPointerPair error(GetCurrentTidOrInvalid(), pc, bp, + sp, a1, a2); in_report.ReportError(error); } @@ -412,7 +421,8 @@ hdesc1.chunk_access.chunk_begin != hdesc2.chunk_access.chunk_begin; // check whether left is an address of a global variable - GlobalAddressDescription gdesc1, gdesc2; + UNINITIALIZED GlobalAddressDescription gdesc1; + UNINITIALIZED GlobalAddressDescription gdesc2; if (GetGlobalAddressInformation(left, 0, &gdesc1)) return !GetGlobalAddressInformation(right - 1, 0, &gdesc2) || !gdesc1.PointsInsideTheSameVariable(gdesc2); @@ -491,8 +501,8 @@ (void)exp; ScopedInErrorReport in_report(fatal); - ErrorGeneric error(GetCurrentTidOrInvalid(), pc, bp, sp, addr, is_write, - access_size); + UNINITIALIZED ErrorGeneric error(GetCurrentTidOrInvalid(), pc, bp, sp, addr, + is_write, access_size); in_report.ReportError(error); } diff --git a/compiler-rt/lib/asan/asan_stack.h b/compiler-rt/lib/asan/asan_stack.h --- a/compiler-rt/lib/asan/asan_stack.h +++ b/compiler-rt/lib/asan/asan_stack.h @@ -32,24 +32,24 @@ // as early as possible (in functions exposed to the user), as we generally // don't want stack trace to contain functions from ASan internals. -#define GET_STACK_TRACE(max_size, fast) \ - BufferedStackTrace stack; \ - if (max_size <= 2) { \ - stack.size = max_size; \ - if (max_size > 0) { \ - stack.top_frame_bp = GET_CURRENT_FRAME(); \ - stack.trace_buffer[0] = StackTrace::GetCurrentPc(); \ - if (max_size > 1) stack.trace_buffer[1] = GET_CALLER_PC(); \ - } \ - } else { \ - stack.Unwind(StackTrace::GetCurrentPc(), \ - GET_CURRENT_FRAME(), nullptr, fast, max_size); \ +#define GET_STACK_TRACE(max_size, fast) \ + UNINITIALIZED BufferedStackTrace stack; \ + if (max_size <= 2) { \ + stack.size = max_size; \ + if (max_size > 0) { \ + stack.top_frame_bp = GET_CURRENT_FRAME(); \ + stack.trace_buffer[0] = StackTrace::GetCurrentPc(); \ + if (max_size > 1) \ + stack.trace_buffer[1] = GET_CALLER_PC(); \ + } \ + } else { \ + stack.Unwind(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), nullptr, \ + fast, max_size); \ } -#define GET_STACK_TRACE_FATAL(pc, bp) \ - BufferedStackTrace stack; \ - stack.Unwind(pc, bp, nullptr, \ - common_flags()->fast_unwind_on_fatal) +#define GET_STACK_TRACE_FATAL(pc, bp) \ + UNINITIALIZED BufferedStackTrace stack; \ + stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_fatal) #define GET_STACK_TRACE_FATAL_HERE \ GET_STACK_TRACE(kStackTraceMax, common_flags()->fast_unwind_on_fatal) diff --git a/compiler-rt/lib/asan/asan_stats.cpp b/compiler-rt/lib/asan/asan_stats.cpp --- a/compiler-rt/lib/asan/asan_stats.cpp +++ b/compiler-rt/lib/asan/asan_stats.cpp @@ -105,7 +105,7 @@ } void FillMallocStatistics(AsanMallocStats *malloc_stats) { - AsanStats stats; + UNINITIALIZED AsanStats stats; GetAccumulatedStats(&stats); malloc_stats->blocks_in_use = stats.mallocs; malloc_stats->size_in_use = stats.malloced; @@ -119,7 +119,7 @@ } static void PrintAccumulatedStats() { - AsanStats stats; + UNINITIALIZED AsanStats stats; GetAccumulatedStats(&stats); // Use lock to keep reports from mixing up. Lock lock(&print_lock); @@ -136,7 +136,7 @@ using namespace __asan; uptr __sanitizer_get_current_allocated_bytes() { - AsanStats stats; + UNINITIALIZED AsanStats stats; GetAccumulatedStats(&stats); uptr malloced = stats.malloced; uptr freed = stats.freed; @@ -146,13 +146,13 @@ } uptr __sanitizer_get_heap_size() { - AsanStats stats; + UNINITIALIZED AsanStats stats; GetAccumulatedStats(&stats); return stats.mmaped - stats.munmaped; } uptr __sanitizer_get_free_bytes() { - AsanStats stats; + UNINITIALIZED AsanStats stats; GetAccumulatedStats(&stats); uptr total_free = stats.mmaped - stats.munmaped diff --git a/compiler-rt/lib/msan/msan.h b/compiler-rt/lib/msan/msan.h --- a/compiler-rt/lib/msan/msan.h +++ b/compiler-rt/lib/msan/msan.h @@ -270,7 +270,7 @@ const int STACK_TRACE_TAG_VPTR = STACK_TRACE_TAG_FIELDS + 1; #define GET_MALLOC_STACK_TRACE \ - BufferedStackTrace stack; \ + UNINITIALIZED BufferedStackTrace stack; \ if (__msan_get_track_origins() && msan_inited) \ stack.Unwind(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), \ nullptr, common_flags()->fast_unwind_on_malloc, \ @@ -281,7 +281,7 @@ // unwinder which is based on libunwind is not async signal safe and causes // random freezes in forking applications as well as in signal handlers. #define GET_STORE_STACK_TRACE_PC_BP(pc, bp) \ - BufferedStackTrace stack; \ + UNINITIALIZED BufferedStackTrace stack; \ if (__msan_get_track_origins() > 1 && msan_inited) { \ int size = flags()->store_context_size; \ if (!SANITIZER_CAN_FAST_UNWIND) \ @@ -293,7 +293,7 @@ GET_STORE_STACK_TRACE_PC_BP(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME()) #define GET_FATAL_STACK_TRACE_PC_BP(pc, bp) \ - BufferedStackTrace stack; \ + UNINITIALIZED BufferedStackTrace stack; \ if (msan_inited) { \ stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_fatal); \ } diff --git a/compiler-rt/lib/msan/msan.cpp b/compiler-rt/lib/msan/msan.cpp --- a/compiler-rt/lib/msan/msan.cpp +++ b/compiler-rt/lib/msan/msan.cpp @@ -147,7 +147,7 @@ static void InitializeFlags() { SetCommonFlagsDefaults(); { - CommonFlags cf; + UNINITIALIZED CommonFlags cf; cf.CopyFrom(*common_flags()); cf.external_symbolizer_path = GetEnv("MSAN_SYMBOLIZER_PATH"); cf.malloc_context_size = 20; @@ -197,7 +197,7 @@ if (Verbosity()) Printf("MSAN_OPTIONS=exit_code is deprecated! " "Please use MSAN_OPTIONS=exitcode instead.\n"); - CommonFlags cf; + UNINITIALIZED CommonFlags cf; cf.CopyFrom(*common_flags()); cf.exitcode = f->exit_code; OverrideCommonFlags(cf); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h @@ -353,7 +353,7 @@ DCHECK_GT(max_count, 0); TransferBatch *b = nullptr; constexpr uptr kShuffleArraySize = 48; - uptr shuffle_array[kShuffleArraySize]; + UNINITIALIZED uptr shuffle_array[kShuffleArraySize]; uptr count = 0; for (uptr i = region; i < region + n_chunks * size; i += size) { shuffle_array[count++] = i; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h @@ -241,7 +241,7 @@ int unique_tid) { ensureCurrentEpoch(dtls); uptr cur_idx = nodeToIndex(cur_node); - uptr added_edges[40]; + UNINITIALIZED uptr added_edges[40]; uptr n_added_edges = g_.addEdges(dtls->getLocks(current_epoch_), cur_idx, added_edges, ARRAY_SIZE(added_edges)); for (uptr i = 0; i < n_added_edges; i++) { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h @@ -215,6 +215,7 @@ # define UNLIKELY(x) (x) # define PREFETCH(x) /* _mm_prefetch(x, _MM_HINT_NTA) */ (void)0 # define WARN_UNUSED_RESULT +# define UNINITIALIZED #else // _MSC_VER # define ALWAYS_INLINE inline __attribute__((always_inline)) # define ALIAS(x) __attribute__((alias(SANITIZER_STRINGIFY(x)))) @@ -234,6 +235,11 @@ # define PREFETCH(x) __builtin_prefetch(x) # endif # define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) +# if __has_attribute(uninitialized) +# define UNINITIALIZED __attribute__((uninitialized)) +# else // __has_attribute(uninitialized) +# define UNINITIALIZED +# endif // __has_attribute(uninitialized) #endif // _MSC_VER #if !defined(_MSC_VER) || defined(__clang__) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp --- a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp @@ -305,7 +305,7 @@ // the stack limit enforced by TSan (-Wframe-larger-than=512). On the other // hand, the bigger the buffer is, the more the chance the error report will // fit into it. - char local_buffer[400]; + UNINITIALIZED char local_buffer[400]; SharedPrintfCodeNoBuffer(append_pid, local_buffer, ARRAY_SIZE(local_buffer), format, args); } diff --git a/compiler-rt/lib/tsan/rtl/tsan_flags.cpp b/compiler-rt/lib/tsan/rtl/tsan_flags.cpp --- a/compiler-rt/lib/tsan/rtl/tsan_flags.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_flags.cpp @@ -55,7 +55,7 @@ SetCommonFlagsDefaults(); { // Override some common flags defaults. - CommonFlags cf; + UNINITIALIZED CommonFlags cf; cf.CopyFrom(*common_flags()); cf.external_symbolizer_path = GetEnv("TSAN_SYMBOLIZER_PATH"); cf.allow_addr2line = true; diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cpp b/compiler-rt/lib/ubsan/ubsan_diag.cpp --- a/compiler-rt/lib/ubsan/ubsan_diag.cpp +++ b/compiler-rt/lib/ubsan/ubsan_diag.cpp @@ -47,7 +47,7 @@ if (!flags()->print_stacktrace) return; - BufferedStackTrace stack; + UNINITIALIZED BufferedStackTrace stack; ubsan_GetStackTrace(&stack, kStackTraceMax, pc, bp, nullptr, common_flags()->fast_unwind_on_fatal); stack.Print(); diff --git a/compiler-rt/lib/ubsan/ubsan_flags.cpp b/compiler-rt/lib/ubsan/ubsan_flags.cpp --- a/compiler-rt/lib/ubsan/ubsan_flags.cpp +++ b/compiler-rt/lib/ubsan/ubsan_flags.cpp @@ -48,7 +48,7 @@ void InitializeFlags() { SetCommonFlagsDefaults(); { - CommonFlags cf; + UNINITIALIZED CommonFlags cf; cf.CopyFrom(*common_flags()); cf.external_symbolizer_path = GetFlag("UBSAN_SYMBOLIZER_PATH"); OverrideCommonFlags(cf); diff --git a/compiler-rt/test/asan/TestCases/Linux/check_memcpy.c b/compiler-rt/test/asan/TestCases/Linux/check_memcpy.c new file mode 100644 --- /dev/null +++ b/compiler-rt/test/asan/TestCases/Linux/check_memcpy.c @@ -0,0 +1,10 @@ +// Verify runtime doesn't contain compiler-emitted memcpy/memmove calls. +// +// REQUIRES: shared_unwind, x86_64-target-arch + +// RUN: %clang_asan -O1 %s -o %t +// RUN: llvm-objdump -d -l %t | FileCheck %s + +int main() { return 0; } + +// CHECK-NOT: {{(callq|jmpq) .*<(__interceptor_.*)?mem(cpy|set)>}} diff --git a/compiler-rt/test/msan/Linux/check_memcpy.c b/compiler-rt/test/msan/Linux/check_memcpy.c new file mode 100644 --- /dev/null +++ b/compiler-rt/test/msan/Linux/check_memcpy.c @@ -0,0 +1,10 @@ +// Verify runtime doesn't contain compiler-emitted memcpy/memmove calls. +// +// REQUIRES: shared_unwind, x86_64-target-arch + +// RUN: %clang_msan -O1 %s -o %t +// RUN: llvm-objdump -d -l %t | FileCheck %s + +int main() { return 0; } + +// CHECK-NOT: {{(callq|jmpq) .*<(__interceptor_.*)?mem(cpy|set)>}} diff --git a/compiler-rt/test/tsan/Linux/check_memcpy.c b/compiler-rt/test/tsan/Linux/check_memcpy.c --- a/compiler-rt/test/tsan/Linux/check_memcpy.c +++ b/compiler-rt/test/tsan/Linux/check_memcpy.c @@ -5,16 +5,11 @@ // This could fail if using a static libunwind because that static libunwind // could be uninstrumented and contain memcpy/memmove calls not intercepted by // tsan. -// REQUIRES: shared_unwind +// REQUIRES: shared_unwind, x86_64-target-arch // RUN: %clang_tsan -O1 %s -o %t // RUN: llvm-objdump -d -l %t | FileCheck %s -int main() { - return 0; -} - -// CHECK-NOT: callq {{.*<(__interceptor_)?mem(cpy|set)>}} -// tail calls: -// CHECK-NOT: jmpq {{.*<(__interceptor_)?mem(cpy|set)>}} +int main() { return 0; } +// CHECK-NOT: {{(callq|jmpq) .*<(__interceptor_.*)?mem(cpy|set)>}}