https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48463
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-08-05
CC| |marxin at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
I confirm that, it's caused by generated deleting dtor:
virtual ClassB::~ClassB() (struct ClassB * const this)
{
<bb 2>:
ClassB::~ClassB (this_2(D));
operator delete (this_2(D), 8);
return;
}
The dtor is given the same source line as it's abstract origin and all
statements in the function are given line after the origin. Resulting
in bogus output:
$ gcov -b tc.gcda
...
function _ZN6ClassBD0Ev called 1 returned 100% blocks executed 100%
function _ZN6ClassBD2Ev called 1 returned 100% blocks executed 100%
3: 10:ClassB::~ClassB()
-: 11:{
1: 12: std::cout << "Bey, ClassB!" << std::endl;
call 0 returned 100%
call 1 returned 100%
2: 13:}
call 0 returned 100% // ClassB::~ClassB (this_2(D));
call 1 returned 100% // operator delete (this_2(D), 8);
-: 14:
First idea about how to fix the issues is to ignore all fns with an abstract
origin?
diff --git a/gcc/coverage.c b/gcc/coverage.c
index d4d371e..0cf5ebb 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -642,6 +642,11 @@ coverage_begin_function (unsigned lineno_checksum,
unsigned cfg_checksum)
if (no_coverage || !bbg_file_name)
return 0;
+ /* Do not output any abstract origin function. */
+ tree abstract = DECL_ABSTRACT_ORIGIN (current_function_decl);
+ if (abstract)
+ return 0;
+
xloc = expand_location (DECL_SOURCE_LOCATION (current_function_decl));
/* Announce function */
I'm going to discuss that with Honza.