diff options
Diffstat (limited to 'test/msan/check-handler.cc')
-rw-r--r-- | test/msan/check-handler.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/msan/check-handler.cc b/test/msan/check-handler.cc new file mode 100644 index 000000000000..4721f8c3068e --- /dev/null +++ b/test/msan/check-handler.cc @@ -0,0 +1,16 @@ +// RUN: %clangxx_msan -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s + +// Verify that CHECK handler prints a stack on CHECK fail. + +#include <stdlib.h> + +int main(void) { + // Allocate chunk from the secondary allocator to trigger CHECK(IsALigned()) + // in its free() path. + void *p = malloc(8 << 20); + free(reinterpret_cast<char*>(p) + 1); + // CHECK: MemorySanitizer: bad pointer + // CHECK: MemorySanitizer CHECK failed + // CHECK: #0 + return 0; +} |