Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / Darwin / malloc-stack-logging.cpp
blob8d9c2122d0e6c81d256ad4c6d1a898fcceefb741
1 // Test that MallocStackLogging=1 doesn't crash. MallocStackLogging turns on
2 // callbacks from mmap/munmap libc function into libmalloc. Darwin-specific
3 // ThreadState initialization needs to avoid calling the library functions (and
4 // use syscalls directly) to make sure other interceptors aren't called.
6 // RUN: %clangxx_tsan -O1 %s -o %t
7 // RUN: MallocStackLogging=1 %run %t 2>&1 | FileCheck %s
8 #include <pthread.h>
9 #include <stdlib.h>
10 #include <stdio.h>
12 void *foo(void *p) {
13 return NULL;
16 int main() {
17 pthread_t t;
18 pthread_create(&t, NULL, foo, NULL);
19 pthread_join(t, NULL);
20 fprintf(stderr, "Done.\n");
21 return 0;
24 // CHECK: Done.