summaryrefslogtreecommitdiff
path: root/test/msan/check-handler.cpp
blob: 4721f8c3068e33cf78474d13dd6268b3b04ce83d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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;
}