public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94883] New: coroutines: ICE building folly in verify_gimple_stmt, at tree-cfg.c:4959
@ 2020-04-30 12:48 iains at gcc dot gnu.org
2020-04-30 12:48 ` [Bug c++/94883] " iains at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: iains at gcc dot gnu.org @ 2020-04-30 12:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94883
Bug ID: 94883
Summary: coroutines: ICE building folly in verify_gimple_stmt,
at tree-cfg.c:4959
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: iains at gcc dot gnu.org
Target Milestone: ---
Created attachment 48423
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48423&action=edit
fix under test
The following should compile but produces:
folly-2.C:59:1: internal compiler error: in verify_gimple_stmt, at
tree-cfg.c:4959
The problem here is that target cleanup expressions have been added to the
initialisers for the awaitable (and returns of non-trivial values from
await_suspend() calls. This is because the expansion of the co_await into its
control flow is not apparent to the machinery adding the target cleanup
expressions. The solution being tested is simply to recreate target
expressions as the co_awaits are lowered. Teaching the machinery to handle
walking co_await expressions in different ways at different points (outside the
coroutine transformation) seems overly complex.
===
namespace std {
template <typename a, typename...> struct coroutine_traits : a {};
template <typename = void> struct coroutine_handle;
template <> struct coroutine_handle<> {};
template <typename> struct coroutine_handle : coroutine_handle<> {};
struct b {
bool await_ready();
void await_suspend(coroutine_handle<>);
void await_resume();
};
} // namespace std
template <typename d> auto ab(int ac, d ad) -> decltype(ad.e(ac));
int f;
class h {
class j {
public:
bool await_ready();
void await_suspend(std::coroutine_handle<>);
void await_resume();
};
public:
void get_return_object();
std::b initial_suspend();
j final_suspend();
void unhandled_exception();
template <typename g>
auto await_transform (g c) { return ab(f, c); }
};
template <typename, typename = int> class k {
public:
using promise_type = h;
using i = std::coroutine_handle<>;
class l {
public:
~l();
operator bool();
};
class m {
public:
bool await_ready();
i await_suspend(std::coroutine_handle<>);
l await_resume();
};
class n {
public:
m e(int);
};
n ah();
};
template <typename ai, typename aj, typename ak>
k<aj>
my_coro (k<aj, ak> am, ai) {
if (auto an = co_await am.ah())
;
}
void foo () {
k<int> a;
my_coro (a, [] {});
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/94883] coroutines: ICE building folly in verify_gimple_stmt, at tree-cfg.c:4959
2020-04-30 12:48 [Bug c++/94883] New: coroutines: ICE building folly in verify_gimple_stmt, at tree-cfg.c:4959 iains at gcc dot gnu.org
@ 2020-04-30 12:48 ` iains at gcc dot gnu.org
2020-04-30 14:59 ` cvs-commit at gcc dot gnu.org
2020-04-30 15:07 ` iains at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: iains at gcc dot gnu.org @ 2020-04-30 12:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94883
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Assignee|unassigned at gcc dot gnu.org |iains at gcc dot gnu.org
Last reconfirmed| |2020-04-30
Ever confirmed|0 |1
Keywords| |ice-on-valid-code
Target Milestone|--- |10.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/94883] coroutines: ICE building folly in verify_gimple_stmt, at tree-cfg.c:4959
2020-04-30 12:48 [Bug c++/94883] New: coroutines: ICE building folly in verify_gimple_stmt, at tree-cfg.c:4959 iains at gcc dot gnu.org
2020-04-30 12:48 ` [Bug c++/94883] " iains at gcc dot gnu.org
@ 2020-04-30 14:59 ` cvs-commit at gcc dot gnu.org
2020-04-30 15:07 ` iains at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-30 14:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94883
--- Comment #1 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:aa94a22f5cb337e173d7119ffd5a92f1e607f544
commit r10-8074-gaa94a22f5cb337e173d7119ffd5a92f1e607f544
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Wed Apr 29 19:46:35 2020 +0100
coroutines: Fix handling of target cleanup exprs [PR94883]
The problem here is that target cleanup expressions have been
added to the initialisers for the awaitable (and returns of
non-trivial values from await_suspend() calls. This is because
the expansion of the co_await into its control flow is not
apparent to the machinery adding the target cleanup expressions.
The solution being tested is simply to recreate target expressions
as the co_awaits are lowered. Teaching the machinery to handle
walking co_await expressions in different ways at different points
(outside the coroutine transformation) seems overly complex.
gcc/cp/ChangeLog:
2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
PR c++/94883
* coroutines.cc (register_awaits): Update target
expressions for awaitable and suspend handle
initializers.
gcc/testsuite/ChangeLog:
2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
PR c++/94883
* g++.dg/coroutines/pr94883-folly-2.C: New test.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/94883] coroutines: ICE building folly in verify_gimple_stmt, at tree-cfg.c:4959
2020-04-30 12:48 [Bug c++/94883] New: coroutines: ICE building folly in verify_gimple_stmt, at tree-cfg.c:4959 iains at gcc dot gnu.org
2020-04-30 12:48 ` [Bug c++/94883] " iains at gcc dot gnu.org
2020-04-30 14:59 ` cvs-commit at gcc dot gnu.org
@ 2020-04-30 15:07 ` iains at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: iains at gcc dot gnu.org @ 2020-04-30 15:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94883
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
so fixed
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-30 15:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30 12:48 [Bug c++/94883] New: coroutines: ICE building folly in verify_gimple_stmt, at tree-cfg.c:4959 iains at gcc dot gnu.org
2020-04-30 12:48 ` [Bug c++/94883] " iains at gcc dot gnu.org
2020-04-30 14:59 ` cvs-commit at gcc dot gnu.org
2020-04-30 15:07 ` iains 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).