1 // ASan-poisoned memory should be ignored if use_poisoned is false.
2 // REQUIRES: asan
3 // RUN: LSAN_BASE="report_objects=1:use_stacks=0:use_registers=0"
4 // RUN: %clangxx_lsan %s -o %t
5 // RUN: %env_lsan_opts=$LSAN_BASE:"use_poisoned=0" not %run %t 2>&1 | FileCheck %s
6 // RUN: %env_lsan_opts=$LSAN_BASE:"use_poisoned=1" %run %t 2>&1
7 
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <sanitizer/asan_interface.h>
11 #include <assert.h>
12 #include "sanitizer_common/print_address.h"
13 
14 void **p;
15 
main()16 int main() {
17   p = new void *;
18   *p = malloc(1337);
19   print_address("Test alloc: ", 1, *p);
20   __asan_poison_memory_region(p, sizeof(*p));
21   return 0;
22 }
23 // CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
24 // CHECK: LeakSanitizer: detected memory leaks
25 // CHECK: [[ADDR]] (1337 bytes)
26 // CHECK: SUMMARY: AddressSanitizer:
27