public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "njuwy at smail dot nju.edu.cn" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/101192] New: [GCOV] The coverage of a callee function goes wrong. Date: Thu, 24 Jun 2021 11:58:20 +0000 [thread overview] Message-ID: <bug-101192-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101192 Bug ID: 101192 Summary: [GCOV] The coverage of a callee function goes wrong. 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=gcc COLLECT_LTO_WRAPPER=/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=release -enable-languages=c,c++ -disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.2.0 (GCC) $ cat test.c #include<stdio.h> #include<stdlib.h> char a[] = "12345"; char b[] = "12345"; void loop(char *pz, char *pzDta) { for (;;) { switch (*(pz++) = *(pzDta++)) { case 0: goto loopDone2; case '"': case '\\': pz[-1] = '\\'; *(pz++) = pzDta[-1]; } } loopDone2:; if (a - pz != b - pzDta) abort(); } int main() { loop(a, b); exit(0); } $ gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov libgcov profiling error:/home/wangyang/coverage/test/test.gcda:overwriting an existing profile data with a different timestamp File 'test.c' Lines executed:71.43% of 14 Creating 'test.c.gcov' -: 0:Source:test.c -: 0:Graph:test.gcno -: 0:Data:test.gcda -: 0:Runs:1 -: 1:#include<stdio.h> -: 2:#include<stdlib.h> -: 3:char a[] = "12345"; -: 4:char b[] = "12345"; -: 5: 6: 6:void loop(char *pz, char *pzDta) { -: 7: for (;;) { 6: 8: switch (*(pz++) = *(pzDta++)) { 1: 9: case 0: 1: 10: goto loopDone2; -: 11: #####: 12: case '"': -: 13: case '\\': #####: 14: pz[-1] = '\\'; #####: 15: *(pz++) = pzDta[-1]; -: 16: } -: 17: } 1: 18:loopDone2:; -: 19: 1: 20: if (a - pz != b - pzDta) #####: 21: abort(); 1: 22:} -: 23: 1: 24:int main() { 1: 25: loop(a, b); 1: 26: exit(0); -: 27:} Lets see line 6, "loop" function was only executed once.
next reply other threads:[~2021-06-24 11:58 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-24 11:58 njuwy at smail dot nju.edu.cn [this message] 2021-07-02 7:17 ` [Bug gcov-profile/101192] " marxin at gcc dot gnu.org 2021-08-13 10:36 ` njuwy at smail dot nju.edu.cn
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-101192-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).