1 // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s
9 void bar(jmp_buf env
) {
12 memcpy(env2
, env
, sizeof(jmp_buf));
17 void foo(jmp_buf env
) {
23 __attribute__((noinline
)) void badguy() {
25 pthread_mutex_init(&mtx
, 0);
26 pthread_mutex_lock(&mtx
);
27 pthread_mutex_destroy(&mtx
);
30 __attribute__((noinline
)) void mymain() {
32 if (setjmp(env
) == 42) {
37 fprintf(stderr
, "FAILED\n");
47 // CHECK: WARNING: ThreadSanitizer: destroy of a locked mutex
48 // CHECK: #0 pthread_mutex_destroy