llvm-project/compiler-rt/test/profile/gcov-__gcov_flush-terminate.c
Fangrui Song 82fecab85a [gcov] Bump default version to 11.1
The gcov version is set to 11.1 (compatible with gcov 9) even if
`-Xclang -coverage-version=` specified version is less than 11.1.

Therefore, we can drop producer support for version < 11.1.
2025-01-02 23:01:28 -08:00

24 lines
1.0 KiB
C

/// https://bugs.llvm.org/show_bug.cgi?id=38067
/// An abnormal exit does not clear execution counts of subsequent instructions.
// RUN: mkdir -p %t.dir && cd %t.dir
// RUN: %clang --coverage %s -o %t -dumpdir ./
// RUN: test -f gcov-__gcov_flush-terminate.gcno
// RUN: rm -f gcov-__gcov_flush-terminate.gcda && %expect_crash %run %t
// RUN: llvm-cov gcov -t gcov-__gcov_flush-terminate.gcda | FileCheck %s
// CHECK: -: 0:Runs:1
void __gcov_dump(void);
void __gcov_reset(void);
int main(void) { // CHECK: 1: [[#@LINE]]:int main(void)
int i = 22; // CHECK-NEXT: 1: [[#@LINE]]:
__gcov_dump(); // CHECK-NEXT: 1: [[#@LINE]]:
__gcov_reset(); // CHECK-NEXT: 1: [[#@LINE]]:
i = 42; // CHECK-NEXT: 1: [[#@LINE]]:
__builtin_trap(); // CHECK-NEXT: 1: [[#@LINE]]:
i = 84; // CHECK-NEXT: 1: [[#@LINE]]:
return 0; // CHECK-NEXT: 1: [[#@LINE]]:
}