1 // RUN: %clangxx_tsan %s -o %t && %run %t 2>&1 | FileCheck %s
4 // FIXME: Very flaky on PPC with COMPILER_RT_DEBUG.
5 // https://github.com/google/sanitizers/issues/1792
6 // UNSUPPORTED: !compiler-rt-optimized && ppc
8 // Test case for https://github.com/google/sanitizers/issues/1540
16 #include <sys/types.h>
21 static void handler(int sig
) {
27 static void *thr1(void *p
) {
32 static void *thr(void *p
) {
34 for (int i
= 0; i
< sizeof(th
) / sizeof(th
[0]); i
++)
35 pthread_create(&th
[i
], 0, thr1
, 0);
36 for (int i
= 0; i
< sizeof(th
) / sizeof(th
[0]); i
++)
37 pthread_join(th
[i
], 0);
42 struct sigaction act
= {};
43 act
.sa_handler
= &handler
;
44 if (sigaction(SIGPROF
, &act
, 0)) {
50 t
.it_value
.tv_sec
= 0;
51 t
.it_value
.tv_usec
= 10;
52 t
.it_interval
= t
.it_value
;
53 if (setitimer(ITIMER_PROF
, &t
, 0)) {
59 for (int i
= 0; i
< sizeof(th
) / sizeof(th
[0]); i
++)
60 pthread_create(&th
[i
], 0, thr
, 0);
61 for (int i
= 0; i
< sizeof(th
) / sizeof(th
[0]); i
++)
62 pthread_join(th
[i
], 0);
64 fprintf(stderr
, "DONE\n");
68 // CHECK-NOT: WARNING: ThreadSanitizer:
70 // CHECK-NOT: WARNING: ThreadSanitizer: