diff options
| author | Kostya Serebryany <kcc@google.com> | 2015-03-10 01:58:27 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2015-03-10 01:58:27 +0000 |
| commit | 48a4023f40e59ba4731e7e5bd48ff2ff2a77c646 (patch) | |
| tree | b7d421f6a8555401590e4f38d59b3444a6465508 /compiler-rt | |
| parent | f81340096ddf2b5a75eee94a09ad30a7501ed816 (diff) | |
| download | bcm5719-llvm-48a4023f40e59ba4731e7e5bd48ff2ff2a77c646.tar.gz bcm5719-llvm-48a4023f40e59ba4731e7e5bd48ff2ff2a77c646.zip | |
[sanitizer] fix instrumentation with -mllvm -sanitizer-coverage-block-threshold=0 to actually do something useful.
llvm-svn: 231736
Diffstat (limited to 'compiler-rt')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc | 3 | ||||
| -rw-r--r-- | compiler-rt/test/asan/TestCases/Linux/coverage-levels.cc | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc index 7b7225f187c..112e4896cf7 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc @@ -812,7 +812,8 @@ SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov(u32 *guard) { } SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_cov_with_check(u32 *guard) { atomic_uint32_t *atomic_guard = reinterpret_cast<atomic_uint32_t*>(guard); - if (__sanitizer::atomic_load(atomic_guard, memory_order_relaxed)) + if (static_cast<s32>( + __sanitizer::atomic_load(atomic_guard, memory_order_relaxed)) < 0) __sanitizer_cov(guard); } SANITIZER_INTERFACE_ATTRIBUTE void diff --git a/compiler-rt/test/asan/TestCases/Linux/coverage-levels.cc b/compiler-rt/test/asan/TestCases/Linux/coverage-levels.cc index f84fd0bf6a9..63bed650ba0 100644 --- a/compiler-rt/test/asan/TestCases/Linux/coverage-levels.cc +++ b/compiler-rt/test/asan/TestCases/Linux/coverage-levels.cc @@ -6,6 +6,8 @@ // RUN: ASAN_OPTIONS=coverage=1:coverage_bitset=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 // RUN: %clangxx_asan -O1 -fsanitize-coverage=3 %s -o %t // RUN: ASAN_OPTIONS=coverage=1:coverage_bitset=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 +// RUN: %clangxx_asan -O1 -fsanitize-coverage=3 -mllvm -sanitizer-coverage-block-threshold=0 %s -o %t +// RUN: ASAN_OPTIONS=coverage=1:coverage_bitset=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 // RUN: %clangxx_asan -O1 -fsanitize-coverage=3 -mllvm -sanitizer-coverage-8bit-counters=1 %s -o %t // RUN: ASAN_OPTIONS=coverage=1:coverage_counters=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK_COUNTERS |

