public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/101360] New: [Gcov] the assignment statement is marked as executed twice while the similar statement has executed one time
@ 2021-07-07  6:06 byone.heng at gmail dot com
  0 siblings, 0 replies; only message in thread
From: byone.heng at gmail dot com @ 2021-07-07  6:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101360

            Bug ID: 101360
           Summary: [Gcov] the assignment statement is marked as executed
                    twice while the similar statement has executed one
                    time
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: byone.heng at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

$./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
const short int true_var = 1;
static signed char false_var = 0;
extern inline __attribute__ ((__always_inline__, __gnu_inline__)) char *
strstr (const char *haystack, const char *needle)
{
  return __builtin_strstr (haystack, needle);
}
int
main (int argc, const char **argv)
{
  if( true_var > 0 )
  {
  char *substr = strstr (argv[0], "\n");
  char *another = strstr (argv[0], "\r\n");
  }
  return 0;
}

$gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov

        -:    5:const short int true_var = 1;
        -:    6:static signed char false_var = 0;
        -:    7:
        -:    8:extern inline __attribute__ ((__always_inline__,
__gnu_inline__)) char *
        -:    9:strstr (const char *haystack, const char *needle)
        -:   10:{
        2:   11:  return __builtin_strstr (haystack, needle);
        -:   12:}
        -:   13:
        -:   14:int
        1:   15:main (int argc, const char **argv)
        -:   16:{
        1:   17:  if( true_var > 0 )
        -:   18:  {
        1:   19:  char *substr = strstr (argv[0], "\n");
        2:   20:  char *another = strstr (argv[0], "\r\n");
        -:   21:  }
        1:   22:  return 0;
        -:   23:}

Line 20 should be executed one time.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-07  6:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07  6:06 [Bug gcov-profile/101360] New: [Gcov] the assignment statement is marked as executed twice while the similar statement has executed one time byone.heng at gmail dot com

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).