https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104051
Bug ID: 104051
Summary: [coroutines] ICE: tree check: expected target_expr,
have call_expr in
coro_diagnose_throwing_final_aw_expr, at
cp/coroutines.cc:880 since r11-7528-g9ee91079fd5879cb
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: asolokha at gmx dot com
CC: unassigned at gcc dot gnu.org
Target Milestone: ---
+++ This bug was initially created as a clone of Bug #104050 +++
g++ 12.0.0 20220109 snapshot (g:49d73c9fb644673323845efebfe6b3106e70af8a) ICEs
when compiling the testcase from PR104050 w/ the following modification
applied:
% diff -u mfytqxkl.cc yhcitpuk.cc
--- mfytqxkl.cc 2022-01-16 21:37:48.356869976 +0700
+++ yhcitpuk.cc 2022-01-16 21:37:52.201613444 +0700
@@ -12,7 +12,7 @@
return std::coroutine_handle<promise>::from_promise(*this);
}
auto initial_suspend() { return std::suspend_always(); }
- auto final_suspend() noexcept { return final_awaitable(); }
+ auto final_suspend() noexcept { return true; }
void unhandled_exception();
};
template <typename T> struct task {
% g++-12.0.0 -fcoroutines -c yhcitpuk.cc
yhcitpuk.cc: In function 'task<std::vector<int> > foo()':
yhcitpuk.cc:28:1: internal compiler error: tree check: expected target_expr,
have call_expr in coro_diagnose_throwing_final_aw_expr, at cp/coroutines.cc:880
28 | }
| ^
0x86d620 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/tree.c:8702
0x68afad tree_operand_check_code(tree_node*, tree_code, int, char const*, int,
char const*)
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/tree.h:3950
0x68afad coro_diagnose_throwing_final_aw_expr
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/coroutines.cc:880
0x9a20b5 build_init_or_final_await
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/coroutines.cc:2532
0x9a4480 coro_rewrite_function_body
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/coroutines.cc:4304
0x9a9f43 morph_fn_to_coro(tree_node*, tree_node**, tree_node**)
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/coroutines.cc:4451
0x9f4f84 finish_function(bool)
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/decl.c:17600
0xaeaa99 cp_parser_function_definition_after_declarator
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/parser.c:31176
0xaebd18 cp_parser_function_definition_from_specifiers_and_declarator
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/parser.c:31089
0xaebd18 cp_parser_init_declarator
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/parser.c:22518
0xac5f09 cp_parser_simple_declaration
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/parser.c:15230
0xaf6f25 cp_parser_declaration
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/parser.c:14916
0xaf78ea cp_parser_toplevel_declaration
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/parser.c:14937
0xaf78ea cp_parser_translation_unit
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/parser.c:4988
0xaf78ea c_parse_file()
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/cp/parser.c:47942
0xc2e10d c_common_parse_file()
/var/tmp/portage/sys-devel/gcc-12.0.0_p20220109/work/gcc-12-20220109/gcc/c-family/c-opts.c:1238