public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "byone.heng at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/101342] [Gcov] wrong coverage for the function with a loop statement Date: Tue, 06 Jul 2021 12:48:07 +0000 [thread overview] Message-ID: <bug-101342-4-dpY9tlLtsa@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-101342-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101342 Xiaoyuan Xie <byone.heng at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[Gcov] Wrong coverage with |[Gcov] wrong coverage for |"for(;;a++)" loop |the function with a loop |statement |statement --- Comment #1 from Xiaoyuan Xie <byone.heng at gmail dot com> --- $./gcc -v Using built-in specs. COLLECT_GCC=./gcc COLLECT_LTO_WRAPPER=/home/x/project/gcc/build/install/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../configure --prefix=/home/x/project/gcc/build/install --enable-checking=release --enable-languages=c,c++ --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.0.0 20210105 (experimental) (GCC) $cat test.c static short int true_var = 1; signed char false_var = 0; typedef unsigned V __attribute__ ((vector_size (16))); V foo (unsigned x, V v) { do { v %= x; x = 1; } while (v[1]); return v; } int main () { V x = foo (5, (V) { 0, 1 }); if (x[0] || x[1] || x[2] || x[3]) __builtin_abort(); return 0; } $gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov -: 1:/* { dg-do run } */ -: 2:/* { dg-additional-options "-w -Wno-psabi" } */ -: 3: -: 4:static short int true_var = 1; -: 5:signed char false_var = 0; -: 6: -: 7:typedef unsigned V __attribute__ ((vector_size (16))); -: 8: -: 9:V 2: 10:foo (unsigned x, V v) -: 11:{ -: 12: do { 2: 13: v %= x; 2: 14: x = 1; 2: 15: } while (v[1]); 1: 16: return v; -: 17:} -: 18: -: 19:int 1: 20:main () -: 21:{ 1: 22: V x = foo (5, (V) { 0, 1 }); 1: 23: if (x[0] || x[1] || x[2] || x[3]) #####: 24: __builtin_abort(); 1: 25: return 0; -: 26:} In my opinion, line 10 should be executed one time.
next prev parent reply other threads:[~2021-07-06 12:48 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-06 12:21 [Bug gcov-profile/101342] New: [Gcov] Wrong coverage with "for(;;a++)" " byone.heng at gmail dot com 2021-07-06 12:48 ` byone.heng at gmail dot com [this message] 2021-07-06 13:21 ` [Bug gcov-profile/101342] [Gcov] wrong coverage for the function with a " byone.heng at gmail dot com 2021-07-06 15:03 ` schwab@linux-m68k.org
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-101342-4-dpY9tlLtsa@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).