1/// https://bugs.llvm.org/show_bug.cgi?id=38067
2/// An abnormal exit does not clear execution counts of subsequent instructions.
3// RUN: mkdir -p %t.dir && cd %t.dir
4// RUN: %clang --coverage %s -o %t -dumpdir ./
5// RUN: test -f gcov-__gcov_flush-terminate.gcno
6
7// RUN: rm -f gcov-__gcov_flush-terminate.gcda && %expect_crash %run %t
8// RUN: llvm-cov gcov -t gcov-__gcov_flush-terminate.gcda | FileCheck %s
9
10// CHECK: -: 0:Runs:1
11
12void __gcov_dump(void);
13void __gcov_reset(void);
14
15int main(void) { // CHECK: 1: [[#@LINE]]:int main(void)
16 int i = 22; // CHECK-NEXT: 1: [[#@LINE]]:
17 __gcov_dump(); // CHECK-NEXT: 1: [[#@LINE]]:
18 __gcov_reset(); // CHECK-NEXT: 1: [[#@LINE]]:
19 i = 42; // CHECK-NEXT: 1: [[#@LINE]]:
20 __builtin_trap(); // CHECK-NEXT: 1: [[#@LINE]]:
21 i = 84; // CHECK-NEXT: 1: [[#@LINE]]:
22 return 0; // CHECK-NEXT: 1: [[#@LINE]]:
23}
24

source code of compiler-rt/test/profile/gcov-__gcov_flush-terminate.c