1// RUN: %clangxx_msan -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
2
3// Verify that CHECK handler prints a stack on CHECK fail.
4
5#include <stdlib.h>
6
7int main(void) {
8 // Allocate chunk from the secondary allocator to trigger CHECK(IsALigned())
9 // in its free() path.
10 void *p = malloc(size: 8 << 20);
11 free(ptr: reinterpret_cast<char*>(p) + 1);
12 // CHECK: MemorySanitizer: bad pointer
13 // CHECK: MemorySanitizer: CHECK failed
14 // CHECK: #0
15 return 0;
16}
17

source code of compiler-rt/test/msan/check-handler.cpp