1 | // Test for disabling LSan at link-time. |
2 | // RUN: %clangxx_lsan %s -o %t |
3 | // RUN: %env_lsan_opts=use_stacks=0:use_registers=0 %run %t |
4 | // RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t foo 2>&1 | FileCheck %s |
5 | // |
6 | // UNSUPPORTED: darwin |
7 | |
8 | #include <sanitizer/lsan_interface.h> |
9 | |
10 | int argc_copy; |
11 | |
12 | extern "C" { |
13 | int __attribute__((used)) __lsan_is_turned_off() { |
14 | return (argc_copy == 1); |
15 | } |
16 | } |
17 | |
18 | int main(int argc, char *argv[]) { |
19 | volatile int *x = new int; |
20 | *x = 42; |
21 | argc_copy = argc; |
22 | return 0; |
23 | } |
24 | |
25 | // CHECK: SUMMARY: {{(.*)}}Sanitizer: 4 byte(s) leaked in 1 allocation(s) |
26 | |