| 1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s |
|---|---|
| 2 | |
| 3 | #include <stdio.h> |
| 4 | #include <stdlib.h> |
| 5 | |
| 6 | static void atexit5() { |
| 7 | fprintf(stderr, format: "5"); |
| 8 | } |
| 9 | |
| 10 | static void atexit4() { |
| 11 | fprintf(stderr, format: "4"); |
| 12 | } |
| 13 | |
| 14 | static void atexit3() { |
| 15 | fprintf(stderr, format: "3"); |
| 16 | } |
| 17 | |
| 18 | static void atexit2() { |
| 19 | fprintf(stderr, format: "2"); |
| 20 | } |
| 21 | |
| 22 | static void atexit1() { |
| 23 | fprintf(stderr, format: "1"); |
| 24 | } |
| 25 | |
| 26 | static void atexit0() { |
| 27 | fprintf(stderr, format: "\n"); |
| 28 | } |
| 29 | |
| 30 | int main() { |
| 31 | atexit(func: atexit0); |
| 32 | atexit(func: atexit1); |
| 33 | atexit(func: atexit2); |
| 34 | atexit(func: atexit3); |
| 35 | atexit(func: atexit4); |
| 36 | atexit(func: atexit5); |
| 37 | } |
| 38 | |
| 39 | // CHECK-NOT: FATAL: ThreadSanitizer |
| 40 | // CHECK-NOT: WARNING: ThreadSanitizer |
| 41 | // CHECK: 54321 |
| 42 |
