[mlir] More fixes for 9fddaf6b14102963f12dbb9730f101fc52e662c1
[llvm-project.git] / compiler-rt / test / lsan / TestCases / use_poisoned_asan.cpp
blob2cc05b5dcf655ce53bc8fb0a3aae8d58efaa8e48
1 // ASan-poisoned memory should be ignored if use_poisoned is false.
2 // REQUIRES: asan
3 // RUN: %clangxx_lsan %s -o %t
4 // RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_poisoned=0" not %run %t 2>&1 | FileCheck %s
5 // RUN: %env_lsan_opts="report_objects=1:use_stacks=0:use_registers=0:use_poisoned=1" %run %t 2>&1
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <sanitizer/asan_interface.h>
10 #include <assert.h>
11 #include "sanitizer_common/print_address.h"
13 void **p;
15 int main() {
16 p = new void *;
17 *p = malloc(1337);
18 print_address("Test alloc: ", 1, *p);
19 __asan_poison_memory_region(p, sizeof(*p));
20 return 0;
22 // CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
23 // CHECK: LeakSanitizer: detected memory leaks
24 // CHECK: [[ADDR]] (1337 bytes)
25 // CHECK: SUMMARY: AddressSanitizer: