https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83878
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Known to work| |8.1.0, 9.0
Resolution|--- |FIXED
Known to fail| |7.3.0
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Marco Castelluccio from comment #2)
> Created attachment 44267 [details]
> 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.
Sorry for overlooking the test-case. It's fixed in r247374 where I improved
gcov locations. It's part of GCC 8.1. Please update to it. No plans to backport
that.