diff options
author | Kuba Mracek <mracek@apple.com> | 2016-11-28 21:28:41 +0000 |
---|---|---|
committer | Kuba Mracek <mracek@apple.com> | 2016-11-28 21:28:41 +0000 |
commit | 809dea2aeb5317da8a82405f5eca50a928ed3efb (patch) | |
tree | 1ded7dda09953835de5cd51331b01264b6c7bf06 | |
parent | 48090f5b82248ac83c49990d2796484a3ed858b2 (diff) | |
download | bcm5719-llvm-809dea2aeb5317da8a82405f5eca50a928ed3efb.tar.gz bcm5719-llvm-809dea2aeb5317da8a82405f5eca50a928ed3efb.zip |
[asan] Attempt to fix the debug_double_free.cc testcase on Windows after r288065.
llvm-svn: 288067
-rw-r--r-- | compiler-rt/test/asan/TestCases/debug_double_free.cc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/compiler-rt/test/asan/TestCases/debug_double_free.cc b/compiler-rt/test/asan/TestCases/debug_double_free.cc index 22081c3de4e..c3699b9762d 100644 --- a/compiler-rt/test/asan/TestCases/debug_double_free.cc +++ b/compiler-rt/test/asan/TestCases/debug_double_free.cc @@ -4,11 +4,29 @@ #include <stdio.h> #include <stdlib.h> +// FIXME: Doesn't work with DLLs +// XFAIL: win32-dynamic-asan + +// If we use %p with MSVC, it comes out all upper case. Use %08x to get +// lowercase hex. +#ifdef _MSC_VER +# ifdef _WIN64 +# define PTR_FMT "0x%08llx" +# else +# define PTR_FMT "0x%08x" +# endif +#else +# define PTR_FMT "%p" +#endif + char *heap_ptr; int main() { + // Disable stderr buffering. Needed on Windows. + setvbuf(stderr, NULL, _IONBF, 0); + heap_ptr = (char *)malloc(10); - fprintf(stderr, "heap_ptr: %p\n", heap_ptr); + fprintf(stderr, "heap_ptr: " PTR_FMT "\n", heap_ptr); // CHECK: heap_ptr: 0x[[ADDR:[0-9a-f]+]] free(heap_ptr); @@ -23,7 +41,7 @@ void __asan_on_error() { fprintf(stderr, "%s\n", (present == 1) ? "report present" : ""); // CHECK: report present - fprintf(stderr, "addr: %p\n", addr); + fprintf(stderr, "addr: " PTR_FMT "\n", addr); // CHECK: addr: {{0x0*}}[[ADDR]] fprintf(stderr, "description: %s\n", description); // CHECK: description: double-free |