1 // Make sure coverage is dumped even if there are reported leaks.
2 //
3 // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s -o %t
4 //
5 // RUN: rm -rf %t-dir
6 //
7 // RUN: mkdir -p %t-dir
8 // RUN: %env_asan_opts=coverage=1:coverage_dir=%t-dir:verbosity=1 not %run %t 2>&1 | FileCheck %s
9 // RUN: %sancov print %t-dir/*.sancov 2>&1
10 //
11 // REQUIRES: leak-detection
12 // FIXME: sancov paths not work with adb
13 // UNSUPPORTED: android
14 int *g;
main(int argc,char ** argv)15 int main(int argc, char **argv) {
16 for (int i = 0; i < 10; ++i)
17 g = new int[i];
18 return 0;
19 }
20
21 // CHECK: LeakSanitizer: detected memory leaks
22 // CHECK: SanitizerCoverage: {{.*}}PCs written
23