[Bug c++/98480] New: [coroutines] ICE on co_await in for-loop end condition.
dpsicilia at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Dec 30 16:18:32 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98480
Bug ID: 98480
Summary: [coroutines] ICE on co_await in for-loop end
condition.
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dpsicilia at gmail dot com
Target Milestone: ---
Quick Minimal reproducer: https://godbolt.org/z/Wrv54E
--------------------------------------------------------
Summary: when a co_await is placed in the end condition
of a for loop it causes gcc to ICE. If I pull the
co_await out and store the result in a variable then the
issue goes away.
--------------------------------------------------------
Version of GCC: 10.2.0
System type: Linux x64
Command line: -std=c++20 -fcoroutines
Compiler output: ICE (see godbolt link; full stack trace below).
--------------------------------------------------------
// Standalone reproducer (same as godbolt link above).
#include <coroutine>
struct future {
struct promise_type {
void return_value(int) {}
auto initial_suspend() { return std::suspend_never{}; }
auto final_suspend() { return std::suspend_never{}; }
void unhandled_exception() {}
future get_return_object() { return {}; }
};
bool await_ready() { return true; }
void await_suspend(std::coroutine_handle<>) {}
int await_resume() { return 0; }
};
future co_foo() {
for( int i = 0; i < co_await future{}; ++i );
// ICE -------------^
co_return 0;
}
--------------------------------------------------------
reproducer.cpp: In function ‘void
_Z6co_foov.actor(co_foo()::_Z6co_foov.frame*)’:
reproducer.cpp:17:3: internal compiler error: in fold_convert_loc, at
fold-const.c:2435
285 | for( int i = 0; i < co_await future{}; ++i )
| ^~~
0x5fd0ae fold_convert_loc(unsigned int, tree_node*, tree_node*)
../../gcc/fold-const.c:2435
0x9fae2a gimplify_cond_expr
../../gcc/gimplify.c:4149
0x9f2f1b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gimplify.c:13513
0x9f3705 gimplify_stmt(tree_node**, gimple**)
../../gcc/gimplify.c:6825
0x9f3705 gimplify_statement_list
../../gcc/gimplify.c:1869
0x9f3705 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gimplify.c:14000
0x9f64f9 gimplify_stmt(tree_node**, gimple**)
../../gcc/gimplify.c:6825
0x9f64f9 gimplify_and_add(tree_node*, gimple**)
../../gcc/gimplify.c:486
0x9f64f9 gimplify_loop_expr
../../gcc/gimplify.c:1843
0x9f37b6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gimplify.c:13761
0x9f3705 gimplify_stmt(tree_node**, gimple**)
../../gcc/gimplify.c:6825
0x9f3705 gimplify_statement_list
../../gcc/gimplify.c:1869
0x9f3705 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gimplify.c:14000
0x9f3705 gimplify_stmt(tree_node**, gimple**)
../../gcc/gimplify.c:6825
0x9f3705 gimplify_statement_list
../../gcc/gimplify.c:1869
0x9f3705 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gimplify.c:14000
0x9f9849 gimplify_stmt(tree_node**, gimple**)
../../gcc/gimplify.c:6825
0x9f9849 gimplify_bind_expr
../../gcc/gimplify.c:1424
0x9f3102 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gimplify.c:13757
0x9f3705 gimplify_stmt(tree_node**, gimple**)
../../gcc/gimplify.c:6825
Please submit a full bug report,
More information about the Gcc-bugs
mailing list