Question about the coverage statistics of Gcov

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



$./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? 



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux