public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.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:33:16 +0000 [thread overview] Message-ID: <bug-114245-4-E73sFtzFcR@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114245-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114245 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- 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. If the front end detected that case, we wouldn't need to rely on dead store elimination. Maybe we could even avoid the __cxa_atexit registration if the most derived dtor is trivial (I don't recall if there's some ABI reason we need that registration even if the dtor is known to be a no-op). That is something that that would be much harder for the middle end to do, so is an argument for the front end handling it. If we are allowed to remove the __cxa_atexit call, that changes this from "remove some dead stores even at -O0 which helps some programs with UB" to a more significant optimization.
next prev parent reply other threads:[~2024-03-06 16:33 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-05 20:08 [Bug c++/114245] New: " mwinkler at blizzard dot com 2024-03-06 6:44 ` [Bug c++/114245] " pinskia at gcc dot gnu.org 2024-03-06 6:56 ` pinskia at gcc dot gnu.org 2024-03-06 16:14 ` mwinkler at blizzard dot com 2024-03-06 16:33 ` redi at gcc dot gnu.org [this message] 2024-03-06 16:38 ` jakub at gcc dot gnu.org 2024-05-28 22:17 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-114245-4-E73sFtzFcR@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).