[Bug gcov-profile/85217] New: [GCOV] A no side effect statement between a break statement and a continue statement will lead to incorrect code coverage in gcov
yangyibiao at nju dot edu.cn
gcc-bugzilla@gcc.gnu.org
Thu Apr 5 02:29:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85217
Bug ID: 85217
Summary: [GCOV] A no side effect statement between a break
statement and a continue statement will lead to
incorrect code coverage in gcov
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: gcov-profile
Assignee: unassigned at gcc dot gnu.org
Reporter: yangyibiao at nju dot edu.cn
CC: marxin at gcc dot gnu.org
Target Milestone: ---
$ cat small.c
int a=0;
void main() {
for (;; a++) {
int c[1];
if (a) {
break;
a;
continue;
}
continue;
}
}
$ gcc -w --coverage small.c; ./a.out; gcov-8 small.c; cat small.c.gcov
File 'small.c'
Lines executed:100.00% of 7
Creating 'small.c.gcov'
-: 0:Source:small.c
-: 0:Graph:small.gcno
-: 0:Data:small.gcda
-: 0:Runs:1
-: 0:Programs:1
-: 1:int a=0;
-: 2:
2: 3:void main() {
1: 4: for (;; a++) {
-: 5: int c[1];
2: 6: if (a) {
1: 7: break;
-: 8: a;
1: 9: continue;
-: 10: }
1: 11: continue;
-: 12: }
1: 13:}
Line #9 is wrongly marked as executed. While Line #8 or Line #11 is removed,
the result is correct.
More information about the Gcc-bugs
mailing list