https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96919
Filip Puđak <filip.pudak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |filip.pudak at gmail dot com
--- Comment #3 from Filip Puđak <filip.pudak at gmail dot com> ---
(In reply to Martin Liška from comment #2)
> Using latest GCC release you can see what happens:
>
> $ g++ pr96919.cc --coverage && ./a.out && gcov a-pr96919.cc -t
> hello
> libgcov profiling
> error:/home/marxin/Programming/testcases/a-pr96919.gcda:overwriting an
> existing profile data with a different timestamp
> -: 0:Source:pr96919.cc
> -: 0:Graph:a-pr96919.gcno
> -: 0:Data:a-pr96919.gcda
> -: 0:Runs:1
> -: 1:class Base {
> -: 2:public:
> -: 3: Base() = default;
> 1*: 4: virtual ~Base() = default;
> ------------------
> _ZN4BaseD0Ev:
> #####: 4: virtual ~Base() = default;
> ------------------
> _ZN4BaseD2Ev:
> 1: 4: virtual ~Base() = default;
> ------------------
> -: 5: virtual void foo() = 0;
> -: 6:};
> -: 7:class Hello : public Base {
> -: 8:public:
> -: 9: Hello() = default;
> 1*: 10: ~Hello() = default;
> ------------------
> _ZN5HelloD0Ev:
> #####: 10: ~Hello() = default;
> ------------------
> _ZN5HelloD2Ev:
> 1: 10: ~Hello() = default;
> ------------------
> -: 11: void foo() override;
> -: 12:};
> -: 13:
> -: 14:#include <iostream>
> -: 15:
> -: 16:using namespace std;
> -: 17:
> 1: 18:void Hello::foo() {
> 1: 19: cout << "hello" << endl;
> 1: 20:}
> -: 21:
> 1: 22:int main(int argc, char* argv[]) {
> #####: 23: Hello hello;
> 1: 24: hello.foo();
> 1: 25: return 0;
> -: 26:}
>
> So yes, it's a virtual destructor _ZN4BaseD0Ev that is not called.
> And the not executed line:
> #####: 4: Hello hello;
>
> corresponds to a basic block
>
> <bb 5> :
> <L3>:
> Hello::~Hello (&hello);
> resx 2
>
> which would be executed when the Hellow constructor fails.
Hi Martin,
So according to your analysis would you classify this issue as a bug? Or is it
an NBC change that was introduced?
/Filip