https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93642

            Bug ID: 93642
           Summary: [Coroutines] internal compiler error: in
                    expand_expr_addr_expr_1, at expr.c:8070 using
                    co_return
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wezrule at hotmail dot com
  Target Milestone: ---

Created attachment 47805
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47805&action=edit
Preprocessed file

Using the master git branch from a couple days ago, HEAD is
c7c09af8ef0fe6671c7733d4d67bb73ecf10fc1b. gcc version 10.0.1 20200208
(experimental) (GCC).

I tried to make the code as small as possible while still being able to
reproduce the issue:

c.cpp
#include <coroutines>

struct promise {
  auto initial_suspend() { return std::suspend_always{}; }
  auto final_suspend() noexcept { return std::suspend_always{}; }
  void unhandled_exception();
  auto get_return_object() { return
std::coroutine_handle<promise>::from_promise(*this); }
  void return_void();
};

class task {
public:
  using promise_type = promise;
  task(std::coroutine_handle<promise_type> handle);
};

task func ()
{
  co_return;
}

When using the build command:
g++ -fcoroutines -c c.pp

The following error is given:

during RTL pass: expand
c.cpp: In function ‘task func()’:
c.cpp:20:1: internal compiler error: in expand_expr_addr_expr_1, at expr.c:8070
   20 | }
      | ^
0x74435a expand_expr_addr_expr_1
        ../../gcc/expr.c:8070
0xcc7f24 expand_expr_addr_expr
        ../../gcc/expr.c:8183
0xcc7f24 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc/expr.c:11358
0xb8d959 expand_normal
        ../../gcc/expr.h:288
0xb8d959 precompute_register_parameters
        ../../gcc/calls.c:982
0xb97137 expand_call(tree_node*, rtx_def*, int)
        ../../gcc/calls.c:4397
0xcc7d5b expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc/expr.c:11130
0xba9509 expand_expr
        ../../gcc/expr.h:282
0xba9509 expand_call_stmt
        ../../gcc/cfgexpand.c:2703
0xba9509 expand_gimple_stmt_1
        ../../gcc/cfgexpand.c:3682
0xba9509 expand_gimple_stmt
        ../../gcc/cfgexpand.c:3847
0xbad843 expand_gimple_basic_block
        ../../gcc/cfgexpand.c:5887
0xbaf816 execute
        ../../gcc/cfgexpand.c:6542

I've attached the preprocessed file too. It is also reproducible on compiler
explorer on the coroutines branch https://godbolt.org/z/3L9bDu

Reply via email to