1// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
2
3#include <stdio.h>
4#include <stdlib.h>
5
6class Logger {
7 public:
8 Logger() {
9 fprintf(stderr, format: "Logger ctor\n");
10 }
11
12 ~Logger() {
13 fprintf(stderr, format: "Logger dtor\n");
14 }
15};
16
17Logger logger;
18
19void log_from_atexit() {
20 fprintf(stderr, format: "In log_from_atexit\n");
21}
22
23int main() {
24 atexit(func: log_from_atexit);
25}
26
27// CHECK: Logger ctor
28// CHECK: In log_from_atexit
29// CHECK: Logger dtor
30

source code of compiler-rt/test/tsan/atexit.cpp