[Bug c++/103868] ICE at end of coroutine when using asio

2023-05-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103868

Jakub Jelinek  changed:

   What|Removed |Added

   Target Milestone|11.4|11.5

--- Comment #8 from Jakub Jelinek  ---
GCC 11.4 is being released, retargeting bugs to GCC 11.5.

[Bug c++/103868] ICE at end of coroutine when using asio

2022-04-28 Thread iains at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103868

Iain Sandoe  changed:

   What|Removed |Added

   Target Milestone|--- |11.4

--- Comment #7 from Iain Sandoe  ---
fixed for gcc-12, back port pending for 11.4.

[Bug c++/103868] ICE at end of coroutine when using asio

2022-04-28 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103868

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Iain D Sandoe :

https://gcc.gnu.org/g:9cb1f565a91e2dd57098c43593954b57c065a19b

commit r12-8307-g9cb1f565a91e2dd57098c43593954b57c065a19b
Author: Nathan Sidwell 
Date:   Sun Apr 3 11:35:03 2022 +0100

c++, coroutines: Avoid expanding within templates [PR103868]

This is a forward-port of a patch by Nathan (against 10.x) which fixes an
open
PR.

We are ICEing because we ended up tsubst_copying something that had already
been tsubst, leading to an assert failure (mostly such repeated tsubsting
is
harmless).

We had a non-dependent co_await in a non-dependent-type template fn, so we
processed it at definition time, and then reprocessed at instantiation
time.
We fix this here by deferring substitution while processing templates.

Additional observations (for a better future fix, in the GCC13 timescale):

Exprs only have dependent type if at least one operand is dependent which
was
what the current code was intending to do.  Coroutines have the additional
wrinkle, that the current fn's type is an implicit operand.

So, if the coroutine function's type is not dependent, and the operand is
not
dependent, we should determine the type of the co_await expression using
the
DEPENDENT_EXPR wrapper machinery.  That allows us to determine the
subexpression type, but leave its operand unchanged and then instantiate it
later.

PR c++/103868

gcc/cp/ChangeLog:

* coroutines.cc (finish_co_await_expr): Do not process
non-dependent
coroutine expressions at template definition time.
(finish_co_yield_expr): Likewise.
(finish_co_return_stmt): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/pr103868.C: New test.

Co-Authored-by: Iain Sandoe 

[Bug c++/103868] ICE at end of coroutine when using asio

2022-04-18 Thread iains at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103868

Iain Sandoe  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |iains at gcc dot gnu.org

--- Comment #5 from Iain Sandoe  ---
candidate patch:
https://gcc.gnu.org/pipermail/gcc-patches/2022-April/593316.html

[Bug c++/103868] ICE at end of coroutine when using asio

2022-01-04 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103868

Martin Liška  changed:

   What|Removed |Added

   Keywords|needs-bisection,|
   |needs-reduction |
 CC||iains at gcc dot gnu.org,
   ||ville.voutilainen at gmail dot 
com

--- Comment #4 from Martin Liška  ---
Likely started with r11-4386-g9e2256dcd481ffe3, it's rejected before the
revision.

[Bug c++/103868] ICE at end of coroutine when using asio

2022-01-04 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103868

--- Comment #3 from Martin Liška  ---
Created attachment 52116
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52116=edit
Partially reduced test-case

The test-case fails with the following on master:

$ ./xgcc -B. /tmp/x.ii -c -std=c++20 -w
during RTL pass: expand
/tmp/x.ii: In function ‘void
malloy::test::client_ws_handler_coro(client_ws_handler_coro(malloy::error_code,
std::shared_ptr
>)::_ZN6malloy4test22client_ws_handler_coroILb0EEEN5boost4asio9awaitableIvNS3_15any_io_executorEEENS2_6system10error_codeESt10shared_ptrINS_9websocket10connectionILb1.Frame*)’:
/tmp/x.ii:1035:70: internal compiler error: in make_decl_rtl, at varasm.c:1446
 1035 |   auto size = co_await conn->read(*buffer, boost::asio::use_awaitable);
  |  ^
0x8f7d91 make_decl_rtl(tree_node*)
/home/marxin/Programming/gcc/gcc/varasm.c:1446
0xe7ede7 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
/home/marxin/Programming/gcc/gcc/expr.c:10550
0xe87d77 expand_expr
/home/marxin/Programming/gcc/gcc/expr.h:301
0xe87d77 expand_expr_addr_expr_1
/home/marxin/Programming/gcc/gcc/expr.c:8427
0xe7e2c4 expand_expr_addr_expr
/home/marxin/Programming/gcc/gcc/expr.c:8548
0xe7e2c4 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
/home/marxin/Programming/gcc/gcc/expr.c:11764
0xe8aa46 store_expr(tree_node*, rtx_def*, int, bool, bool)
/home/marxin/Programming/gcc/gcc/expr.c:6087
0xe8c25d expand_assignment(tree_node*, tree_node*, bool)
/home/marxin/Programming/gcc/gcc/expr.c:5819
0xd4b07a expand_gimple_stmt_1
/home/marxin/Programming/gcc/gcc/cfgexpand.c:3930
0xd4b07a expand_gimple_stmt
/home/marxin/Programming/gcc/gcc/cfgexpand.c:4028
0xd5155c expand_gimple_basic_block
/home/marxin/Programming/gcc/gcc/cfgexpand.c:6069
0xd53727 execute
/home/marxin/Programming/gcc/gcc/cfgexpand.c:6795
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

Note it uses coroutines and -fconcepts.

$ (gdb) p debug_tree(decl)
 
unit-size 
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x77462b28
fields 
public abstract external autoinline decl_3 decl_8 QI
/tmp/x.ii:982:7 align:16 warn_if_not_align:0 context 
full-name "constexpr boost::asio::detail::awaitable_frame::~awaitable_frame() noexcept ()"
not-really-extern chain >
context 
full-name "std::__n4861::coroutine_traits,
boost::system::error_code, std::shared_ptr
> >::promise_type"
X() X(constX&) this=(X&) n_parents=1 use_template=1 interface-unknown
pointer_to_this  chain >
addressable used read QI /tmp/x.ii:1035:70 size  unit-size 
align:8 warn_if_not_align:0>
$1 = void

[Bug c++/103868] ICE at end of coroutine when using asio

2022-01-03 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103868

Martin Liška  changed:

   What|Removed |Added

   Last reconfirmed||2022-01-03
 CC||marxin at gcc dot gnu.org
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Keywords||needs-bisection,
   ||needs-reduction

--- Comment #2 from Martin Liška  ---
I can reproduce it, reducing right now..

[Bug c++/103868] ICE at end of coroutine when using asio

2021-12-30 Thread ashenglandelbro at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103868

--- Comment #1 from ashenglandelbro at protonmail dot com ---
Created attachment 52092
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52092=edit
.ii for the file that failed to compile

Compressed as an xz as the raw text is 8mb