public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "iains at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98704] coroutine_handle::done() == false after promise's unhandled_exception() has thrown Date: Fri, 12 Mar 2021 15:28:27 +0000 [thread overview] Message-ID: <bug-98704-4-uglxh7HGg6@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-98704-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98704 Iain Sandoe <iains at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 Assignee|unassigned at gcc dot gnu.org |iains at gcc dot gnu.org Last reconfirmed| |2021-03-12 --- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> --- Created attachment 50376 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50376&action=edit Patch under test Thanks for the report, and suggested fix. This is the subject of CWG 2541 (about the wording, which is potentially misleading). Your possible fix doesn't do quite the right thing (because of said misleading wording, I suspect) - it's necessary to ensure that the destroy() entry does the correct thing when called. ======= When promise.unhandled_exception () is entered, the coroutine is considered to be still running - returning from the method will cause the final await expression to be evaluated. If the method throws, that action is considered to make the coroutine suspend (since, otherwise, it would be impossible to reclaim its resources, since one cannot destroy a running coro). The wording issue is to do with how to represent the place at which the coroutine should be considered suspended. For the implementation here, that place is immediately before the promise life-time ends. A handler for the rethrown exception, can thus call xxxx.destroy() which will run DTORs for the promise and any parameter copies [as needed] then the coroutine frame will be deallocated. At present, we also set "done=true" in this case (for compatibility with other current implementations). One might consider 'done()' to be misleading in the case of an abnormal termination - that is also part of the CGW 2451 discussion. I modified the reproducer into a test case that also checks that the resources are properly cleaned up on an exceptional termination.
next prev parent reply other threads:[~2021-03-12 15:28 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-16 8:30 [Bug c++/98704] New: " m.krause@tu-harburg.de 2021-01-17 13:29 ` [Bug c++/98704] " m.krause@tu-harburg.de 2021-03-12 15:28 ` iains at gcc dot gnu.org [this message] 2021-03-15 15:56 ` cvs-commit at gcc dot gnu.org 2021-03-22 22:04 ` cvs-commit at gcc dot gnu.org 2021-03-24 12:40 ` iains 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-98704-4-uglxh7HGg6@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).