public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Question about the coverage statistics of Gcov
@ 2021-04-02  8:50 heng zhang
  2021-04-02 23:15 ` Jim Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: heng zhang @ 2021-04-02  8:50 UTC (permalink / raw)
  To: gcc-help

$./gcc -v                                                                                                                                                                    
使用内建 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:../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 版本 11.0.0 20210105 (experimental) (GCC)

$./gcov -v                                                                                                                                                                   
gcov (GCC) 11.0.0 20210105 (experimental)
Copyright © 2021 Free Software Foundation, Inc.

$gcc -O0 --coverage test.c;./a.out;gcov test;cat test.c.gcov
  1        -:    0:Source:test.c
  2         -:    0:Graph:test.gcno
  3         -:    0:Data:test.gcda                                                                                                                                                
  4         -:    0:Runs:1
  5         -:    1:#include <stdio.h>
  6         -:    2:
  7         -:    3:
  8         1:    4:static int fun()
  9         -:    5:{
 10         1:    6:     float a = 0x1.9p+1;
 11         1:    7:     int b = 0xA20B95AEL;
 12        1*:    8:     for(int i=0;i<2;i++)
 13         -:    9:     {
 14         1:   10:         int c = 4;
 15         1:   11:         if(a>0)
 16         1:   12:             return 4;
 17         -:   13:     }
 18 #####:   14:     return 1;
 19         -:   15:}
 20         1:   16:int main()
 21         -:   17:{
 22         1:   18:    int result=fun();
 23         1:   19:    printf("%d \n",result);
 24         1:   20:    return 0;
 25         -:   21:}
 26         -:   22:

Why is the executed time of the 8th line performed 1* and what does the symbol ‘*' means?  According to the explanation of the official web,  executed basic blocks having a statement with zero execution_count end with ‘*’ character. For this case, there is not any unexecuted statement in for loop. When the 11th line is pruned, the executed time of the 8th line is only 1. so is it a bug? 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-09  5:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02  8:50 Question about the coverage statistics of Gcov heng zhang
2021-04-02 23:15 ` Jim Wilson
2021-04-06 15:34   ` heng zhang
2021-04-07 20:35     ` Jim Wilson
2021-04-09  5:35       ` heng zhang

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