From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 94F4B3857830; Fri, 6 May 2022 03:11:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94F4B3857830 From: "yangyibiao at nju dot edu.cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/105500] New: [Gcov]wrong freqency for the while loop with struct in the expression Date: Fri, 06 May 2022 03:11:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Version: 7.5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yangyibiao at nju dot edu.cn X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2022 03:11:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105500 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 =3D y.f; return a;=20 } void bar () { while (a.f) { struct S c =3D {0}; foo (0, c); } } int main () { bar ();=20 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 =3D y.f; #####: 6: return a;=20 -: 7:} -: 8: 1: 9:void bar () -: 10:{ 2: 11: while (a.f) -: 12: { #####: 13: struct S c =3D {0}; #####: 14: foo (0, c); -: 15: } 1: 16:} -: 17: 1: 18:int main () -: 19:{ 1: 20: bar ();=20 1: 21: return 0; -: 22:} Line #11 is wrongly marked as executed twice which should be executed once.=