public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/37722] destructors not called on computed goto Date: Mon, 03 Jan 2022 17:33:02 +0000 [thread overview] Message-ID: <bug-37722-4-OOHJodU77K@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-37722-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37722 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think computed gotos are similar to longjmp here, the compiler doesn't know where exactly the jump will go to and so which variables should be destructed on a particular computed goto at runtime. For normal gotos, the compiler knows which scopes will be left and can arrange for those destructors to be run, and similarly which scopes will be entered and can complain if construction of some vars is jumped over. For longjmp, C++ documents it as undefined behavior: https://eel.is/c++draft/csetjmp.syn#2 I'm afraid for computed gotos all we can do is just document something similar for leaving the C++ scopes (and C with cleanup attribute) with computed gotos and similarly document that any crossed initializations of variables are undefined behavior (normal gotos crossing initialization are errors in C++ but not in C).
next prev parent reply other threads:[~2022-01-03 17:33 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-37722-4@http.gcc.gnu.org/bugzilla/> 2013-01-11 14:52 ` timo.kreuzer at reactos dot org 2022-01-03 12:00 ` pinskia at gcc dot gnu.org 2022-01-03 17:33 ` jakub at gcc dot gnu.org [this message] 2023-07-19 16:46 ` ndesaulniers at google dot com 2023-12-21 2:07 ` cvs-commit at gcc dot gnu.org 2023-12-21 2:08 ` jason at gcc dot gnu.org 2024-01-03 4:23 ` egallager at gcc dot gnu.org 2008-10-02 20:46 [Bug c++/37722] New: " cburger at sunysb dot edu 2008-10-02 21:23 ` [Bug middle-end/37722] " pinskia at gcc dot gnu dot org 2009-05-09 8:17 ` scovich at gmail dot com
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-37722-4-OOHJodU77K@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).