Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while using coroutines #1949

Open
thegreathir opened this issue Feb 22, 2024 · 1 comment
Open

Error while using coroutines #1949

thegreathir opened this issue Feb 22, 2024 · 1 comment

Comments

@thegreathir
Copy link

I'm using v1.0.2, this is my code:

#include "kj/async-io.h"

kj::Promise<void> loop(kj::AsyncIoContext &io) {
  auto addr = co_await io.provider->getNetwork().parseAddress("", 12);
  auto receiver = addr->listen();
  auto conn = co_await receiver->accept();
  co_return;
}

int main() {
  auto io = kj::setupAsyncIo();
  loop(io).wait(io.waitScope);
  return 0;
}

This is how I compile it:

set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -freport-bug -fcoroutines")
add_executable(
    main main.cpp
)

set_property(TARGET main PROPERTY CXX_STANDARD 20)
target_link_libraries(main kj)

Am I doing something obviously wrong?
Because compiler crashes:

main.cpp:8:1: internal compiler error: in gimplify_var_or_parm_decl, at gimplify.cc:3058
    8 | }
      | ^
0x1ad33c8 internal_error(char const*, ...)
	???:0
0x6b7b63 fancy_abort(char const*, int, char const*)
	???:0
0xb96497 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	???:0
0xb96546 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	???:0
0xb96a34 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	???:0
0xb965ff gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	???:0
0xb97cbf gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	???:0
0xb96fc5 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	???:0
0xb97c5f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	???:0
0xb96fc5 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	???:0
0xb96326 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	???:0
0xb96fc5 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	???:0
0xb97c5f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
	???:0
0xb9938b gimplify_body(tree_node*, bool)
	???:0
0xb998d0 gimplify_function_tree(tree_node*)
	???:0
0x9f824b cgraph_node::analyze()
	???:0
0xa01796 symbol_table::finalize_compilation_unit()
	???:0
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.

I'm going to report it to GCC btw.

@kentonv
Copy link
Member

kentonv commented Feb 26, 2024

This is a known GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102051

KJ coroutines simply don't work on GCC until this is fixed. Sorry. They work great in Clang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants