brintos

brintos / llvm-project-archived public Read only

0
0
Text · 465 B · 40d7bb0 Raw
25 lines · cpp
1// Check that LSan annotations work fine.2// RUN: %clangxx_lsan -O0 %s -o %t && %run %t3// RUN: %clangxx_lsan -O3 %s -o %t && %run %t4 5#include <sanitizer/lsan_interface.h>6#include <stdlib.h>7 8int *x, *y, *z;9 10int main() {11  x = new int;12  __lsan_ignore_object(x);13 14  z = new int[1000000];  // Large enough for the secondary allocator.15  __lsan_ignore_object(z);16 17  {18    __lsan::ScopedDisabler disabler;19    y = new int;20  }21 22  x = y = z = nullptr;23  return 0;24}25