This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug gcov-profile/83878] Line hit counts are sometimes wrong
- From: "mcastelluccio at mozilla dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 13 Jun 2018 00:37:30 +0000
- Subject: [Bug gcov-profile/83878] Line hit counts are sometimes wrong
- Auto-submitted: auto-generated
- References: <bug-83878-4@http.gcc.gnu.org/bugzilla/>
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.