From ac8217de8323cf7efe1da0fa24b4006c96d82f66 Mon Sep 17 00:00:00 2001 From: Alex Shlyapnikov Date: Mon, 22 Jan 2018 23:28:52 +0000 Subject: [PATCH] Small fixes for detect_invalid_pointer_pairs. Summary: One test-case uses a wrong operation (should be subtraction). Second test-case should declare a global variables before a tested one in order to guarantee we will find a red-zone. Reviewers: kcc, jakubjelinek, alekseyshl Reviewed By: alekseyshl Subscribers: kubamracek Differential Revision: https://reviews.llvm.org/D41481 llvm-svn: 323162 --- .../asan/TestCases/invalid-pointer-pairs-compare-errors.cc | 4 ++++ .../asan/TestCases/invalid-pointer-pairs-subtract-success.cc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cc b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cc index 82f63359ead7..3c4f7d65eeb1 100644 --- a/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cc +++ b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cc @@ -10,8 +10,12 @@ int foo(char *p, char *q) { } char global1[100] = {}, global2[100] = {}; +char __attribute__((used)) smallest_global[5] = {}; char small_global[7] = {}; +char __attribute__((used)) little_global[10] = {}; +char __attribute__((used)) medium_global[4000] = {}; char large_global[5000] = {}; +char __attribute__((used)) largest_global[6000] = {}; int main() { // Heap allocated memory. diff --git a/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-subtract-success.cc b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-subtract-success.cc index 4ce48424899d..de175a778c99 100644 --- a/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-subtract-success.cc +++ b/compiler-rt/test/asan/TestCases/invalid-pointer-pairs-subtract-success.cc @@ -6,7 +6,7 @@ #include int bar(char *p, char *q) { - return p <= q; + return p - q; } char global[10000] = {};