[Bug gcov-profile/83878] Line hit counts are sometimes wrong
mcastelluccio at mozilla dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 13 00:37:00 GMT 2018
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.
More information about the Gcc-bugs
mailing list