annotate compiler-rt/test/tsan/mutex_lock_destroyed.cpp @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1f2b6ac9f198
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clangxx_tsan %s -o %t
anatofuz
parents:
diff changeset
2 // RUN: %deflake %run %t | FileCheck %s
anatofuz
parents:
diff changeset
3 // RUN: %deflake %run %t 1 | FileCheck %s
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 // The pthread_mutex_lock interceptor assumes incompatible internals w/ NetBSD
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
6 // XFAIL: target={{.*netbsd.*}}
150
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 #include <pthread.h>
anatofuz
parents:
diff changeset
9 #include <stdio.h>
anatofuz
parents:
diff changeset
10 #include <stdlib.h>
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 int main(int argc, char *argv[]) {
anatofuz
parents:
diff changeset
13 pthread_mutex_t *m = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
anatofuz
parents:
diff changeset
14 pthread_mutex_init(m, 0);
anatofuz
parents:
diff changeset
15 pthread_mutex_lock(m);
anatofuz
parents:
diff changeset
16 pthread_mutex_unlock(m);
anatofuz
parents:
diff changeset
17 pthread_mutex_destroy(m);
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 if (argc > 1 && argv[1][0] == '1')
anatofuz
parents:
diff changeset
20 free(m);
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 pthread_mutex_lock(m);
anatofuz
parents:
diff changeset
23 // CHECK: WARNING: ThreadSanitizer: use of an invalid mutex (e.g. uninitialized or destroyed)
anatofuz
parents:
diff changeset
24 // CHECK: #0 pthread_mutex_lock
anatofuz
parents:
diff changeset
25 // CHECK: #1 main {{.*}}mutex_lock_destroyed.cpp:[[@LINE-3]]
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 return 0;
anatofuz
parents:
diff changeset
28 }