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