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
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 // CHECK-NEXT:        -:    0:Programs:1
12 
13 void __gcov_dump(void);
14 void __gcov_reset(void);
15 
main(void)16 int main(void) {                   // CHECK:      1: [[#@LINE]]:int main(void)
17   int i = 22;                      // CHECK-NEXT: 1: [[#@LINE]]:
18   __gcov_dump();                   // CHECK-NEXT: 1: [[#@LINE]]:
19   __gcov_reset();                  // CHECK-NEXT: 1: [[#@LINE]]:
20   i = 42;                          // CHECK-NEXT: 1: [[#@LINE]]:
21   __builtin_trap();                // CHECK-NEXT: 1: [[#@LINE]]:
22   i = 84;                          // CHECK-NEXT: 1: [[#@LINE]]:
23   return 0;                        // CHECK-NEXT: 1: [[#@LINE]]:
24 }
25