]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc
1 // Test that stacks of non-main threads are included in the root set.
2 // RUN: LSAN_BASE="report_objects=1:use_registers=0"
3 // RUN: %clangxx_lsan -pthread %s -o %t
4 // RUN: LSAN_OPTIONS=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
5 // RUN: LSAN_OPTIONS=$LSAN_BASE:"use_stacks=1" %run %t 2>&1
6 // RUN: LSAN_OPTIONS="" %run %t 2>&1
15 void *stacks_thread_func(void *arg
) {
16 int *sync
= reinterpret_cast<int *>(arg
);
17 void *p
= malloc(1337);
18 fprintf(stderr
, "Test alloc: %p.\n", p
);
20 __sync_fetch_and_xor(sync
, 1);
28 int res
= pthread_create(&thread_id
, 0, stacks_thread_func
, &sync
);
30 while (!__sync_fetch_and_xor(&sync
, 0))
34 // CHECK: Test alloc: [[ADDR:.*]].
35 // CHECK: LeakSanitizer: detected memory leaks
36 // CHECK: [[ADDR]] (1337 bytes)
37 // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: