public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug gcov-profile/101414] New: [Gcov] a label statement has incorrect coverage due to an if statement
@ 2021-07-11  7:59 byone.heng at gmail dot com
  0 siblings, 0 replies; only message in thread
From: byone.heng at gmail dot com @ 2021-07-11  7:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101414
           Summary: [Gcov] a label statement has incorrect coverage due to
                    an if statement
           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
——————————————————————————

unsigned long int true_var = 1;
const volatile unsigned short int false_var = 0;

extern int printf (__const char *__restrict __format, ...);

int x = 1;
int main ()
{
    asm goto ("decl %0; jnz %l[a]" :: "m"(x) : "memory" : a);
    if( true_var > 0 )
    {
    printf ("Hello world\n");
    }
a:
    return 0;
}


——————————————————————————


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


        -:    5:unsigned long int true_var = 1;
        -:    6:const volatile unsigned short int false_var = 0;
        -:    7:
        -:    8:extern int printf (__const char *__restrict __format, ...);
        -:    9:
        -:   10:int x = 1;
        1:   11:int main ()
        -:   12:{
        1:   13:    asm goto ("decl %0; jnz %l[a]" :: "m"(x) : "memory" : a);
        1:   14:    if( true_var > 0 )
        -:   15:    {
        1:   16:    printf ("Hello world\n");
        -:   17:    }
    #####:   18:a:
        1:   19:    return 0;
        -:   20:}

Line 18 should be executed.

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

only message in thread, other threads:[~2021-07-11  7:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-11  7:59 [Bug gcov-profile/101414] New: [Gcov] a label statement has incorrect coverage due to an if statement 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).