From 2a54274c255351e068cf70e77a241a965f12a3a4 Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Fri, 6 Sep 2013 12:04:37 +0000 Subject: [ASan] make the check for NULL more portable. llvm-svn: 190139 --- .../lib/asan/lit_tests/TestCases/allocator_returns_null.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'compiler-rt') diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/allocator_returns_null.cc b/compiler-rt/lib/asan/lit_tests/TestCases/allocator_returns_null.cc index 281debba4e2..866ce90e668 100644 --- a/compiler-rt/lib/asan/lit_tests/TestCases/allocator_returns_null.cc +++ b/compiler-rt/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 -- cgit v1.2.3