summaryrefslogtreecommitdiff
path: root/test/sanitizer_common
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-06-03 01:36:53 +0000
committerKostya Serebryany <kcc@google.com>2017-06-03 01:36:53 +0000
commitb88c71e5c6f79459386e2a3e569f970b17a600ac (patch)
tree5f6c3615937a83398a2c2e8e2389f75d59007f11 /test/sanitizer_common
parent8c2855d2320ab8a951a09e50195bd94ba19fcfe5 (diff)
[sanitizer-coverage] test for -fsanitize-coverage=inline-8bit-counters
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@304632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/sanitizer_common')
-rw-r--r--test/sanitizer_common/TestCases/sanitizer_coverage_inline8bit_counter.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/sanitizer_coverage_inline8bit_counter.cc b/test/sanitizer_common/TestCases/sanitizer_coverage_inline8bit_counter.cc
new file mode 100644
index 000000000..b7246ebf2
--- /dev/null
+++ b/test/sanitizer_common/TestCases/sanitizer_coverage_inline8bit_counter.cc
@@ -0,0 +1,23 @@
+// Tests -fsanitize-coverage=inline-8bit-counters
+//
+// REQUIRES: has_sancovcc,stable-runtime
+// UNSUPPORTED: i386-darwin
+//
+// RUN: %clangxx -O0 %s -fsanitize-coverage=inline-8bit-counters 2>&1
+
+#include <stdio.h>
+#include <assert.h>
+
+const char *first_counter;
+
+extern "C"
+void __sanitizer_cov_8bit_counters_init(const char *start, const char *end) {
+ printf("INIT: %p %p\n", start, end);
+ assert(end - start > 1);
+ first_counter = start;
+}
+
+int main() {
+ assert(first_counter);
+ assert(*first_counter == 1);
+}