[compiler-rt] r323162 - Small fixes for detect_invalid_pointer_pairs.

Alex Shlyapnikov via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 15:28:52 PST 2018


Author: alekseyshl
Date: Mon Jan 22 15:28:52 2018
New Revision: 323162

URL: http://llvm.org/viewvc/llvm-project?rev=323162&view=rev
Log:
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

Modified:
    compiler-rt/trunk/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cc
    compiler-rt/trunk/test/asan/TestCases/invalid-pointer-pairs-subtract-success.cc

Modified: compiler-rt/trunk/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cc?rev=323162&r1=323161&r2=323162&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/invalid-pointer-pairs-compare-errors.cc Mon Jan 22 15:28:52 2018
@@ -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.

Modified: compiler-rt/trunk/test/asan/TestCases/invalid-pointer-pairs-subtract-success.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/invalid-pointer-pairs-subtract-success.cc?rev=323162&r1=323161&r2=323162&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/invalid-pointer-pairs-subtract-success.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/invalid-pointer-pairs-subtract-success.cc Mon Jan 22 15:28:52 2018
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 
 int bar(char *p, char *q) {
-  return p <= q;
+  return p - q;
 }
 
 char global[10000] = {};




More information about the llvm-commits mailing list