From 575180dbd29882d566b79a91af3f947fde7525fb Mon Sep 17 00:00:00 2001 From: Timur Iskhodzhanov Date: Mon, 7 Jul 2014 16:22:04 +0000 Subject: [PATCH] [ASan/Win] Unbreak the build after r211216 llvm-svn: 212465 --- .../lib/sanitizer_common/sanitizer_atomic_msvc.h | 21 ++++----------------- .../TestCases/Windows/global_const_string_oob.cc | 2 +- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h b/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h index bff5593..12ffef3 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h @@ -33,33 +33,20 @@ long long _InterlockedCompareExchange64( // NOLINT long long volatile *Destination, // NOLINT long long Exchange, long long Comparand); // NOLINT #pragma intrinsic(_InterlockedCompareExchange64) - -#ifdef _WIN64 -extern "C" long long _InterlockedExchangeAdd64( // NOLINT - long long volatile * Addend, long long Value); // NOLINT -#pragma intrinsic(_InterlockedExchangeAdd64) extern "C" void *_InterlockedCompareExchangePointer( void *volatile *Destination, void *Exchange, void *Comparand); #pragma intrinsic(_InterlockedCompareExchangePointer) -#else -// There's no _InterlockedCompareExchangePointer intrinsic on x86, -// so call _InterlockedCompareExchange instead. extern "C" long __cdecl _InterlockedCompareExchange( // NOLINT long volatile *Destination, // NOLINT long Exchange, long Comparand); // NOLINT #pragma intrinsic(_InterlockedCompareExchange) -inline static void *_InterlockedCompareExchangePointer( - void *volatile *Destination, - void *Exchange, void *Comparand) { - return reinterpret_cast( - _InterlockedCompareExchange( - reinterpret_cast(Destination), // NOLINT - reinterpret_cast(Exchange), // NOLINT - reinterpret_cast(Comparand))); // NOLINT -} +#ifdef _WIN64 +extern "C" long long _InterlockedExchangeAdd64( // NOLINT + long long volatile * Addend, long long Value); // NOLINT +#pragma intrinsic(_InterlockedExchangeAdd64) #endif namespace __sanitizer { diff --git a/compiler-rt/test/asan/TestCases/Windows/global_const_string_oob.cc b/compiler-rt/test/asan/TestCases/Windows/global_const_string_oob.cc index 3b66b8f..b39e3db 100644 --- a/compiler-rt/test/asan/TestCases/Windows/global_const_string_oob.cc +++ b/compiler-rt/test/asan/TestCases/Windows/global_const_string_oob.cc @@ -13,7 +13,7 @@ int main(void) { // CHECK: AddressSanitizer: global-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] // CHECK: READ of size 1 at [[ADDR]] thread T0 // CHECK-NEXT: {{#0 .* main .*global_const_string_oob.cc:}}[[@LINE-5]] -// CHECK: [[ADDR]] is located 5 bytes to the right of global variable [[STR:.*]] from {{'.*global_const_string_oob.cc' .*}} of size 11 +// CHECK: [[ADDR]] is located 5 bytes to the right of global variable [[STR:.*]] defined in {{'.*global_const_string_oob.cc:7:.*' .*}} of size 11 // CHECK: [[STR]] is ascii string 'foobarspam' return 0; } -- 2.7.4