public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/92407] Destruction of objects returned from functions skipped by goto Date: Wed, 20 Dec 2023 17:41:16 +0000 [thread overview] Message-ID: <bug-92407-4-EWIt8E4nEB@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-92407-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92407 --- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:32bd8a1053d25cbb15172294e59a81bc134658aa commit r11-11162-g32bd8a1053d25cbb15172294e59a81bc134658aa Author: Jason Merrill <jason@redhat.com> Date: Sun Jun 4 12:00:55 2023 -0400 c++: NRV and goto [PR92407] Here our named return value optimization was breaking the required destructor when the goto takes 'a' out of scope. A simple fix for the release branches is to disable the optimization in the presence of backward goto. We could do better by disabling the optimization only if there is a backward goto across the variable declaration, but we don't track that, and in GCC 14 we instead make the goto work with NRV. PR c++/92407 gcc/cp/ChangeLog: * cp-tree.h (struct language_function): Add backward_goto. * decl.c (check_goto): Set it. * typeck.c (check_return_expr): Prevent NRV if set. gcc/testsuite/ChangeLog: * g++.dg/opt/nrv22.C: New test. (cherry picked from commit a645347c19b07cc7abd7bf276c6769fc41afc932)
next prev parent reply other threads:[~2023-12-20 17:41 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-92407-4@http.gcc.gnu.org/bugzilla/> 2020-11-16 16:13 ` sichert at in dot tum.de 2023-06-06 1:51 ` jason at gcc dot gnu.org 2023-06-07 1:33 ` cvs-commit at gcc dot gnu.org 2023-06-07 1:33 ` cvs-commit at gcc dot gnu.org 2023-06-07 1:35 ` jason at gcc dot gnu.org 2023-08-31 22:40 ` cvs-commit at gcc dot gnu.org 2023-12-20 17:41 ` cvs-commit at gcc dot gnu.org [this message] 2023-12-20 17:46 ` jason at gcc dot gnu.org 2024-01-24 19:40 ` cvs-commit at gcc dot gnu.org 2024-02-05 18:20 ` jason 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-92407-4-EWIt8E4nEB@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).