https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121914
Bug ID: 121914
Summary: Wrong line coverage in inline function body
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: gcov-profile
Assignee: unassigned at gcc dot gnu.org
Reporter: wentaoz5 at illinois dot edu
Target Milestone: ---
Hit the issue when measuring:
https://sources.debian.org/src/mawk/1.3.4.20200120-3.1/rexp2.c#L179
Here is how to reproduce it using a reduced example
$ gcc --version | head -1
gcc (GCC) 16.0.0 20250907 (experimental)
$ cat > test.c << EOF
__inline__
__attribute__((__always_inline__))
int foo() {
int i = 1;
return 1;
}
int main(void) {
foo();
foo();
return 0;
}
EOF
$ rm -f *.gcda *.gcno; gcc --coverage test.c -o test; ./test; gcov test; \
grep -A5 __inline__ test.c.gcov
-: 1:__inline__
-: 2:__attribute__((__always_inline__))
-: 3:int foo() {
2: 4: int i = 1;
1: 5: return 1;
-: 6:}
where line coverage for line 5 is wrongly 1.