Files
clang-p2996/compiler-rt/test/asan/TestCases/Linux/leak.cpp
Vitaly Buka 3ab118a57d [NFC][Asan] Fix test broken by RegAllocFast
The test worked only because by coincidence register with pointer was
clobbered.
After D52010 value is still preserved.
2020-09-18 16:46:20 -07:00

16 lines
446 B
C++

// Minimal test for LeakSanitizer+AddressSanitizer.
// REQUIRES: leak-detection
//
// RUN: %clangxx_asan %s -o %t
// RUN: %env_asan_opts=detect_leaks=1 not %run %t 2>&1 | FileCheck %s
// RUN: not %run %t 2>&1 | FileCheck %s
// RUN: %env_asan_opts=detect_leaks=0 %run %t
#include <stdio.h>
int *t;
int main(int argc, char **argv) {
t = new int[argc - 1] - 100000;
printf("t: %p\n", t);
}
// CHECK: LeakSanitizer: detected memory leaks