diff options
author | Alexander Potapenko <glider@google.com> | 2013-09-06 12:04:37 +0000 |
---|---|---|
committer | Alexander Potapenko <glider@google.com> | 2013-09-06 12:04:37 +0000 |
commit | 0b2c3a79bbcba15bb973f8199bbd7052b43f548c (patch) | |
tree | 86d5772b5615172a3793809bc4df108c0e554db2 | |
parent | e9e4f04e8320d35ab19dfb8688a7bdd3e5ae7cbb (diff) |
[ASan] make the check for NULL more portable.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@190139 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/asan/lit_tests/TestCases/allocator_returns_null.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/asan/lit_tests/TestCases/allocator_returns_null.cc b/lib/asan/lit_tests/TestCases/allocator_returns_null.cc index 281debba4..866ce90e6 100644 --- a/lib/asan/lit_tests/TestCases/allocator_returns_null.cc +++ b/lib/asan/lit_tests/TestCases/allocator_returns_null.cc @@ -53,7 +53,9 @@ int main(int argc, char **argv) { x = (char*)realloc(t, size); assert(*t == 42); } - fprintf(stderr, "x: %p\n", x); + // The NULL pointer is printed differently on different systems, while (long)0 + // is always the same. + fprintf(stderr, "x: %lx\n", (long)x); return x != 0; } // CHECK-mCRASH: malloc: @@ -68,12 +70,12 @@ int main(int argc, char **argv) { // CHECK-mrCRASH: AddressSanitizer's allocator is terminating the process // CHECK-mNULL: malloc: -// CHECK-mNULL: x: (nil) +// CHECK-mNULL: x: 0 // CHECK-cNULL: calloc: -// CHECK-cNULL: x: (nil) +// CHECK-cNULL: x: 0 // CHECK-coNULL: calloc-overflow: -// CHECK-coNULL: x: (nil) +// CHECK-coNULL: x: 0 // CHECK-rNULL: realloc: -// CHECK-rNULL: x: (nil) +// CHECK-rNULL: x: 0 // CHECK-mrNULL: realloc-after-malloc: -// CHECK-mrNULL: x: (nil) +// CHECK-mrNULL: x: 0 |