You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
426 B
27 lines
426 B
4 months ago
|
// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int n;
|
||
|
const int N = 10000;
|
||
|
|
||
|
static void atexit1() {
|
||
|
n++;
|
||
|
}
|
||
|
|
||
|
static void atexit0() {
|
||
|
fprintf(stderr, "run count: %d\n", n);
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
atexit(atexit0);
|
||
|
for (int i = 0; i < N; i++)
|
||
|
atexit(atexit1);
|
||
|
}
|
||
|
|
||
|
// CHECK-NOT: FATAL: ThreadSanitizer
|
||
|
// CHECK-NOT: WARNING: ThreadSanitizer
|
||
|
// CHECK: run count: 10000
|
||
|
|