From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 46DB83861887; Mon, 21 Sep 2020 11:05:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 46DB83861887 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1600686356; bh=mhf4Yz/AKQML05BjXJETI27iiHXser/jQ8fkRjvnyFs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=duA2gm1ovdbIgxI92ArSbcJ3K/fS+b7hCXkn7QNTiYfqWcCbsiiee70tl6kkPsDfr Kvq8df3MeN2q0NyjXqrsqFBdbNKnvZeylRnY1T0Uf3qqyFCVNIirLTdaFhViV0td51 no5XJxcnQnToYgMzUShIQOr2g3ZS+aeItVULbQfI= From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug gcov-profile/96919] [GCOV] uncovered line of stack allocation while using virutal destructor Date: Mon, 21 Sep 2020 11:05:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: gcov-profile X-Bugzilla-Version: 8.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Sep 2020 11:05:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96919 --- Comment #2 from Martin Li=C5=A1ka --- 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 exis= ting 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() =3D default; 1*: 4: virtual ~Base() =3D default; ------------------ _ZN4BaseD0Ev: #####: 4: virtual ~Base() =3D default; ------------------ _ZN4BaseD2Ev: 1: 4: virtual ~Base() =3D default; ------------------ -: 5: virtual void foo() =3D 0; -: 6:}; -: 7:class Hello : public Base { -: 8:public: -: 9: Hello() =3D default; 1*: 10: ~Hello() =3D default; ------------------ _ZN5HelloD0Ev: #####: 10: ~Hello() =3D default; ------------------ _ZN5HelloD2Ev: 1: 10: ~Hello() =3D default; ------------------ -: 11: void foo() override; -: 12:}; -: 13: -: 14:#include -: 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=20 : : Hello::~Hello (&hello); resx 2 which would be executed when the Hellow constructor fails.=