https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85273
Bug ID: 85273 Summary: [GCOV] return statement in else block of if(1) statement when there is an array declaration statement and a goto statement 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 main() { b: { int c[1]; if (1) ; else return 0; return 0; goto b; } } $ gcc -w --coverage small.c; ./a.out; gcov-8 small.c; cat small.c.gcov File 'small.c' Lines executed:100.00% of 4 Creating 'small.c.gcov' -: 0:Source:small.c -: 0:Graph:small.gcno -: 0:Data:small.gcda -: 0:Runs:1 -: 0:Programs:1 1: 1:int main() { 1: 2:b: -: 3: { -: 4: int c[1]; -: 5: if (1) -: 6: ; -: 7: else 1: 8: return 0; 1: 9: return 0; -: 10: goto b; -: 11: } -: 12:} ********** Line #8 is wrongly marked as executed. While removing any of Line #4 or Line #10, the result is correct.