public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95822] New: [coroutines] compiler internal error with local object with noexcept false destructor
@ 2020-06-22 18:51 victor.burckel at gmail dot com
2020-06-23 9:06 ` [Bug c++/95822] " iains at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: victor.burckel at gmail dot com @ 2020-06-22 18:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95822
Bug ID: 95822
Summary: [coroutines] compiler internal error with local object
with noexcept false destructor
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: victor.burckel at gmail dot com
Target Milestone: ---
It seems that when a coroutine contains a local object whose destructor is
marked as noexcept(false), gcc reaches an unexpected state and aborts.
When compiling the following code with gcc10.1.0 (-std=c++20 -fcoroutines), I
get a compiler internal error:
> internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:2830
Making the destructor noexcept fixes the error. I got the error when using
boost log within a couroutine. It uses a record_pump whose destructor is not
noexcept.
I managed to reproduce with godbolt (both gcc10.1 and gcc trunk give me the
assertion)
https://godbolt.org/z/6JtKsU
#include <coroutine>
struct task {
struct promise_type {
auto initial_suspend() noexcept { return std::suspend_always{}; }
auto final_suspend() noexcept { return std::suspend_always{}; }
void return_void() {}
task get_return_object() { return task{}; }
void unhandled_exception() noexcept {}
};
~task() noexcept {}
bool await_ready() const noexcept { return false; }
void await_suspend(std::coroutine_handle<>) noexcept {}
void await_resume() noexcept {}
};
struct Error {
~Error() noexcept(false) {}
};
task g();
task f() {
Error error;
co_await g();
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95822] [coroutines] compiler internal error with local object with noexcept false destructor
2020-06-22 18:51 [Bug c++/95822] New: [coroutines] compiler internal error with local object with noexcept false destructor victor.burckel at gmail dot com
@ 2020-06-23 9:06 ` iains at gcc dot gnu.org
2020-07-23 6:51 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-23 9:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95822
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-06-23
Target Milestone|--- |10.2
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |iains at gcc dot gnu.org
Keywords| |ice-on-valid-code
Status|UNCONFIRMED |NEW
--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
thanks for the report
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95822] [coroutines] compiler internal error with local object with noexcept false destructor
2020-06-22 18:51 [Bug c++/95822] New: [coroutines] compiler internal error with local object with noexcept false destructor victor.burckel at gmail dot com
2020-06-23 9:06 ` [Bug c++/95822] " iains at gcc dot gnu.org
@ 2020-07-23 6:51 ` rguenth at gcc dot gnu.org
2021-02-16 9:12 ` iains at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-23 6:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95822
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.2 |10.3
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.2 is released, adjusting target milestone.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95822] [coroutines] compiler internal error with local object with noexcept false destructor
2020-06-22 18:51 [Bug c++/95822] New: [coroutines] compiler internal error with local object with noexcept false destructor victor.burckel at gmail dot com
2020-06-23 9:06 ` [Bug c++/95822] " iains at gcc dot gnu.org
2020-07-23 6:51 ` rguenth at gcc dot gnu.org
@ 2021-02-16 9:12 ` iains at gcc dot gnu.org
2021-02-25 19:34 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2021-02-16 9:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95822
--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
Created attachment 50196
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50196&action=edit
Patch for testing
this needs some wider testing.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95822] [coroutines] compiler internal error with local object with noexcept false destructor
2020-06-22 18:51 [Bug c++/95822] New: [coroutines] compiler internal error with local object with noexcept false destructor victor.burckel at gmail dot com
` (2 preceding siblings ...)
2021-02-16 9:12 ` iains at gcc dot gnu.org
@ 2021-02-25 19:34 ` cvs-commit at gcc dot gnu.org
2021-03-22 22:03 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-25 19:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95822
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:
https://gcc.gnu.org/g:7005a50d0121954031a223ea5a6c57aaa7e3efd3
commit r11-7402-g7005a50d0121954031a223ea5a6c57aaa7e3efd3
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Tue Feb 16 09:07:32 2021 +0000
coroutines : Remove throwing_cleanup marks from the ramp [PR95822].
The FE contains a mechanism for cleaning up return expressions if a
function throws during the execution of cleanups prior to the return.
If the original function has a return value with a non-trivial DTOR
and the body contains a var with a DTOR that might throw, the function
decl is marked "throwing_cleanup".
However, we do not [in the coroutine ramp function, which is
synthesised], use any body var types with DTORs that might throw.
The original body [which will then contain the type with the throwing
DTOR] is transformed into the actor function which only contains void
returns, and is also wrapped in a try-catch block.
So (a) the 'throwing_cleanup' is no longer correct for the ramp and
(b) we do not need to transfer it to the actor which only contains
void returns.
gcc/cp/ChangeLog:
PR c++/95822
* coroutines.cc (morph_fn_to_coro): Unconditionally remove any
set throwing_cleanup marker.
gcc/testsuite/ChangeLog:
PR c++/95822
* g++.dg/coroutines/pr95822.C: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95822] [coroutines] compiler internal error with local object with noexcept false destructor
2020-06-22 18:51 [Bug c++/95822] New: [coroutines] compiler internal error with local object with noexcept false destructor victor.burckel at gmail dot com
` (3 preceding siblings ...)
2021-02-25 19:34 ` cvs-commit at gcc dot gnu.org
@ 2021-03-22 22:03 ` cvs-commit at gcc dot gnu.org
2021-03-24 12:42 ` iains at gcc dot gnu.org
2021-07-18 23:48 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-22 22:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95822
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Iain D Sandoe
<iains@gcc.gnu.org>:
https://gcc.gnu.org/g:9f13c7ad960a0f2e150dd2f668a8d155b76389db
commit r10-9510-g9f13c7ad960a0f2e150dd2f668a8d155b76389db
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Tue Feb 16 09:07:32 2021 +0000
coroutines : Remove throwing_cleanup marks from the ramp [PR95822].
The FE contains a mechanism for cleaning up return expressions if a
function throws during the execution of cleanups prior to the return.
If the original function has a return value with a non-trivial DTOR
and the body contains a var with a DTOR that might throw, the function
decl is marked "throwing_cleanup".
However, we do not [in the coroutine ramp function, which is
synthesised], use any body var types with DTORs that might throw.
The original body [which will then contain the type with the throwing
DTOR] is transformed into the actor function which only contains void
returns, and is also wrapped in a try-catch block.
So (a) the 'throwing_cleanup' is no longer correct for the ramp and
(b) we do not need to transfer it to the actor which only contains
void returns.
gcc/cp/ChangeLog:
PR c++/95822
* coroutines.cc (morph_fn_to_coro): Unconditionally remove any
set throwing_cleanup marker.
gcc/testsuite/ChangeLog:
PR c++/95822
* g++.dg/coroutines/pr95822.C: New test.
(cherry picked from commit 7005a50d0121954031a223ea5a6c57aaa7e3efd3)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95822] [coroutines] compiler internal error with local object with noexcept false destructor
2020-06-22 18:51 [Bug c++/95822] New: [coroutines] compiler internal error with local object with noexcept false destructor victor.burckel at gmail dot com
` (4 preceding siblings ...)
2021-03-22 22:03 ` cvs-commit at gcc dot gnu.org
@ 2021-03-24 12:42 ` iains at gcc dot gnu.org
2021-07-18 23:48 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2021-03-24 12:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95822
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---
fixed for master and 10.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/95822] [coroutines] compiler internal error with local object with noexcept false destructor
2020-06-22 18:51 [Bug c++/95822] New: [coroutines] compiler internal error with local object with noexcept false destructor victor.burckel at gmail dot com
` (5 preceding siblings ...)
2021-03-24 12:42 ` iains at gcc dot gnu.org
@ 2021-07-18 23:48 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-18 23:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95822
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |familiebaumanns at gmail dot com
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 96141 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-07-18 23:48 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 18:51 [Bug c++/95822] New: [coroutines] compiler internal error with local object with noexcept false destructor victor.burckel at gmail dot com
2020-06-23 9:06 ` [Bug c++/95822] " iains at gcc dot gnu.org
2020-07-23 6:51 ` rguenth at gcc dot gnu.org
2021-02-16 9:12 ` iains at gcc dot gnu.org
2021-02-25 19:34 ` cvs-commit at gcc dot gnu.org
2021-03-22 22:03 ` cvs-commit at gcc dot gnu.org
2021-03-24 12:42 ` iains at gcc dot gnu.org
2021-07-18 23:48 ` pinskia at gcc dot gnu.org
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).