From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 22AF23858038; Mon, 7 Jun 2021 03:07:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22AF23858038 From: "njuwy at smail dot nju.edu.cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/100938] New: [GCOV] Coverage changes when a statement is divided in multiple lines Date: Mon, 07 Jun 2021 03:07:53 +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: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: njuwy at smail dot nju.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: Mon, 07 Jun 2021 03:07:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100938 Bug ID: 100938 Summary: [GCOV] Coverage changes when a statement is divided in multiple lines Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: njuwy at smail dot nju.edu.cn CC: marxin at gcc dot gnu.org Target Milestone: --- $ gcc -v Using built-in specs. COLLECT_GCC=3Dgcc COLLECT_LTO_WRAPPER=3D/usr/local/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto= -wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure -enable-checking=3Drelease -enable-languages= =3Dc,c++ -disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.2.0 (GCC)=20 $ cat test.c int fn5(int x){ return -x; } int fn2(int x,int y){ return x+3-y; } int fn6(int x,int y){ return x+y; } int fn7(int x){ return 2*x; } int main() { int t1,t2,t3,t4,t5=3D1; int b=3D1,y; y =3D fn5(b && fn2(t1=3Dt2,fn6(fn7(t3) < t4,t5))); y =3D fn5(b && fn2(t1=3Dt2, fn6(fn7(t3) < t4,t5))); } $ gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov File 'test.c' Lines executed:100.00% of 14 Creating 'test.c.gcov' -: 0:Source:test.c -: 0:Graph:test.gcno -: 0:Data:test.gcda -: 0:Runs:1 2: 1:int fn5(int x){ 2: 2:return -x; -: 3:} 2: 4:int fn2(int x,int y){ 2: 5:return x+3-y; -: 6:} 2: 7:int fn6(int x,int y){ 2: 8:return x+y; -: 9:} 2: 10:int fn7(int x){ 2: 11:return 2*x; -: 12:} -: 13: 1: 14:int main() -: 15:{ 1: 16:int t1,t2,t3,t4,t5=3D1; 1: 17:int b=3D1,y; 1*: 18: y =3D fn5(b && fn2(t1=3Dt2,fn6(fn7(t3) < t4,t5))); 2*: 19: y =3D fn5(b && fn2(t1=3Dt2, 1: 20: fn6(fn7(t3) < t4,t5))); -: 21:} Line 18 and 19 should be executed the same number of times=