summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/tsan/atexit.cc
blob: 69acb4dd783fd462c3de76f829093d1907f9a46a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s

#include <stdio.h>
#include <stdlib.h>

class Logger {
 public:
  Logger() {
    fprintf(stderr, "Logger ctor\n");
  }

  ~Logger() {
    fprintf(stderr, "Logger dtor\n");
  }
};

Logger logger;

void log_from_atexit() {
  fprintf(stderr, "In log_from_atexit\n");
}

int main() {
  atexit(log_from_atexit);
}

// CHECK: Logger ctor
// CHECK: In log_from_atexit
// CHECK: Logger dtor
OpenPOWER on IntegriCloud