1 // Regression test. Disabler should not depend on TSD validity.
2 // RUN: %clang_lsan %s -o %t
3 // RUN: %env_lsan_opts="report_objects=1:use_registers=0:use_stacks=0:use_tls=1:use_ld_allocations=0" %run %t
10 #include "sanitizer/lsan_interface.h"
14 void key_destructor(void *arg
) {
16 void *p
= malloc(1337);
17 // Break optimization.
18 fprintf(stderr
, "Test alloc: %p.\n", p
);
19 pthread_setspecific(key
, 0);
23 void *thread_func(void *arg
) {
24 int res
= pthread_setspecific(key
, (void*)1);
30 int res
= pthread_key_create(&key
, &key_destructor
);
33 res
= pthread_create(&thread_id
, 0, thread_func
, 0);
35 res
= pthread_join(thread_id
, 0);