https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110635
Arsen Arsenović <arsen at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2024-07-15 Ever confirmed|0 |1 CC| |arsen at gcc dot gnu.org Status|UNCONFIRMED |NEW Keywords| |ice-on-valid-code --- Comment #1 from Arsen Arsenović <arsen at gcc dot gnu.org> --- confirmed, I've debugged it a bit also, in the following (coroutines.cc:4224 vicinity): if (initial_await != error_mark_node) { /* Build a compound expression that sets the initial-await-resume-called variable true and then calls the initial suspend expression await resume. In the case that the user decides to make the initial await await_resume() return a value, we need to discard it and, it is a reference type, look past the indirection. */ if (INDIRECT_REF_P (initial_await)) initial_await = TREE_OPERAND (initial_await, 0); tree vec = TREE_OPERAND (initial_await, 3); tree aw_r = TREE_VEC_ELT (vec, 2); aw_r = convert_to_void (aw_r, ICV_STATEMENT, tf_warning_or_error); tree update = build2 (MODIFY_EXPR, boolean_type_node, i_a_r_c, boolean_true_node); aw_r = cp_build_compound_expr (update, aw_r, tf_warning_or_error); TREE_VEC_ELT (vec, 2) = aw_r; } ... the code does not anticipate that initial_await is a TARGET_EXPR, and so it fails because it tries to alter a non-existent element 2 (which is meant to correspond to the await_resume of the initial_suspend_awaiter)