From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 333453858401; Wed, 6 Mar 2024 16:38:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 333453858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709743123; bh=iMKHa62+MIQstkcF2SxAwGhS+DcN0rr3a/zSabd2AiY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=x5MCpISksueXsfOGG49jJkPKQtXPH8ubO5RwouUbhW1k9L0NyNDCTi2MEht/A7BRK yxZFm8r3pYGCfn5u0qUKs2dOcVeCazhhOj+doTxa3g6Wgh0j4UviE5jnLlfoLt/w4D yHnGINLyqelWdWcDT2YmRS/T8drFsUKBP63+jg9o= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114245] Defaulted virtual destructors that do no work overwrite the vtable with `-O0` Date: Wed, 06 Mar 2024 16:38:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: cc 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114245 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek --- (In reply to Jonathan Wakely from comment #4) > Updating the vtable is necessary during destruction if a later (i.e. less > derived) destructor calls a virtual function. But if we can tell that the > current dtor and all later base dtors are trivial, then we know that can't > happen. >=20 > If the front end detected that case, we wouldn't need to rely on dead sto= re > elimination. But isn't that just an optimization the user asked not to perform (with usi= ng -O0)? I mean, e.g. the user could care about the vtable updates for e.g. calling methods from the debugger as the destruction of the object progresses.=