This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug gcov-profile/85299] [GCOV] In for(;;), a "if(0) break;" statement is wrongly marked as executed when it is prefixed with an array declaration "int a[1];" and followed by "if(0) continue; break;" in gcov
- From: "yangyibiao at nju dot edu.cn" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 09 Apr 2018 10:08:33 +0000
- Subject: [Bug gcov-profile/85299] [GCOV] In for(;;), a "if(0) break;" statement is wrongly marked as executed when it is prefixed with an array declaration "int a[1];" and followed by "if(0) continue; break;" in gcov
- Auto-submitted: auto-generated
- References: <bug-85299-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85299
--- Comment #1 from Yibiao Yang <yangyibiao at nju dot edu.cn> ---
Bug 85202 is another most similar bug with the "continue" statement.
From my point of view, they should be different bugs.
Here is the copy of Bug 85202:
$ cat small.c
void main() {
int i = 0;
for (; i < 1; i++) {
int b = 0;
&b;
if (0)
continue;
if (1)
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: 1:void main() {
1: 2: int i = 0;
2: 3: for (; i < 1; i++) {
1: 4: int b = 0;
-: 5: &b;
-: 6: if (0)
1: 7: continue;
-: 8: if (1)
1: 9: continue;
-: 10: }
1: 11:}
Line #7 is wrongly marked as executed.