https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105500
Bug ID: 105500 Summary: [Gcov]wrong freqency for the while loop with struct in the expression Product: gcc Version: 7.5.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 struct S { int f; } a; struct S foo (int x, struct S y) { int b = y.f; return a; } void bar () { while (a.f) { struct S c = {0}; foo (0, c); } } int main () { bar (); return 0; } $ gcc -O0 --coverage small.c; ./a.out; gcov small.c; cat small.c.gcov File 'small.c' Lines executed:54.55% of 11 Creating 'small.c.gcov' -: 0:Source:small.c -: 0:Graph:small.gcno -: 0:Data:small.gcda -: 0:Runs:1 -: 0:Programs:1 -: 1:struct S { int f; } a; -: 2: #####: 3:struct S foo (int x, struct S y) -: 4:{ #####: 5: int b = y.f; #####: 6: return a; -: 7:} -: 8: 1: 9:void bar () -: 10:{ 2: 11: while (a.f) -: 12: { #####: 13: struct S c = {0}; #####: 14: foo (0, c); -: 15: } 1: 16:} -: 17: 1: 18:int main () -: 19:{ 1: 20: bar (); 1: 21: return 0; -: 22:} Line #11 is wrongly marked as executed twice which should be executed once.