https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96919
Bug ID: 96919 Summary: [GCOV] uncovered line of stack allocation while using virutal destructor Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: youngseok.roh.de at gmail dot com CC: marxin at gcc dot gnu.org Target Milestone: --- I have different result since GCC8. It looks like connecting to the virtual destructor. <~ GCC 7.4.0> $ cat main.cpp.gcov -: 0:Source:main.cpp -: 0:Graph:main.gcno -: 0:Data:main.gcda -: 0:Runs:1 -: 0:Programs:1 -: 1:#include "hello.h" -: 2: 1: 3:int main(int argc, char* argv[]) { 2: 4: Hello hello; 1: 5: hello.foo(); 1: 6: return 0; -: 7:} -: 8: <GCC 8.2.0 ~> $ cat main.cpp.gcov -: 0:Source:main.cpp -: 0:Graph:main.gcno -: 0:Data:main.gcda -: 0:Runs:1 -: 0:Programs:1 -: 1:#include "hello.h" -: 2: 1: 3:int main(int argc, char* argv[]) { #####: 4: Hello hello; 1: 5: hello.foo(); 1: 6: return 0; -: 7:} -: 8: Example code is here, and commands as well. $ cat hello.h class Base { public: Base() = default; virtual ~Base() = default; virtual void foo() = 0; }; class Hello : public Base { public: Hello() = default; ~Hello() = default; void foo() override; }; $ cat hello.cpp #include "hello.h" #include <iostream> using namespace std; void Hello::foo() { cout << "hello" << endl; } $ cat main.cpp #include "hello.h" int main(int argc, char* argv[]) { Hello hello; hello.foo(); return 0; } g++ -g -c --coverage -O0 -std=c++11 hello.cpp g++ -g -c --coverage -O0 -std=c++11 main.cpp g++ -o test hello.o main.o --coverage -O0