This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gcov-profile/83878] Line hit counts are sometimes wrong


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

--- Comment #2 from Marco Castelluccio <mcastelluccio at mozilla dot com> ---
Created attachment 44267
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44267&action=edit
Archive with GCNO, GCDA, source file and GCOV output

Sorry for replying late, but I just managed to find a reproducible small test
case.

g++ --coverage -fno-exceptions -O0 main.cpp
./a.out
gcov -u -b -c main.cpp

The relevant part is:
> function main called 1 returned 100% blocks executed 94%
>         1:   24:int main(void)
>         -:   25:{
>         2:   26:  Ciao ciao;
> call    0 returned 1
> call    1 returned 1
> unconditional  2 taken 1
>         -:   27:
>         1:   28:  ciao.setName("Marco");

Line 26 is clearly executed once, but gcov shows it as executed twice. The same
happens if you have an if block where you call a constructor.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]