[docs] Fix build-docs.sh
[llvm-project.git] / compiler-rt / test / lsan / TestCases / ignore_object.c
blobbd329ad2e3566e24f1ccad28c713a3d8df16636c
1 // Test for __lsan_ignore_object().
2 // RUN: %clang_lsan %s -o %t
3 // RUN: %env_lsan_opts=report_objects=1:use_registers=0:use_stacks=0:use_tls=0 not %run %t 2>&1 | FileCheck %s
5 // Investigate why it does not fail with use_stack=0
6 // UNSUPPORTED: arm-linux || armhf-linux
8 #include <stdio.h>
9 #include <stdlib.h>
11 #include "sanitizer/lsan_interface.h"
13 int main() {
14 // Explicitly ignored object.
15 void **p = malloc(sizeof(void *));
16 // Transitively ignored object.
17 *p = malloc(666);
18 // Non-ignored object.
19 volatile void *q = malloc(1337);
20 fprintf(stderr, "Test alloc: %p.\n", p);
21 __lsan_ignore_object(p);
22 return 0;
24 // CHECK: Test alloc: [[ADDR:.*]].
25 // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)