public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103868] New: ICE at end of coroutine when using asio
@ 2021-12-30 14:55 ashenglandelbro at protonmail dot com
  2021-12-30 14:59 ` [Bug c++/103868] " ashenglandelbro at protonmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ashenglandelbro at protonmail dot com @ 2021-12-30 14:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103868
           Summary: ICE at end of coroutine when using asio
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ashenglandelbro at protonmail dot com
  Target Milestone: ---

gcc info:

Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/usr/include/dlang/gdc
Target: x86_64-pc-linux-gnu
gcc version 11.1.0 (GCC)

------------
error message:

/usr/bin/g++ -DBOOST_BEAST_USE_STD_STRING_VIEW -DFMT_LOCALE
-DMALLOY_EXPORT_STATIC_DEFINE -DMALLOY_FEATURE_HTML -DMALLOY_FEATURE_TLS
-DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL
-I/home/ash/sources/malloy/test/3rdparty/doctest -I/home/ash/sources/malloy/lib
-I/home/ash/sources/malloy/lib/malloy/..
-I/home/ash/sources/malloy/build/_deps/spdlog-src/include
-I/home/ash/sources/malloy/build/_deps/fmt-src/include -g -std=gnu++20 -MD -MT
test/CMakeFiles/malloy-tests.dir/test_suites/components/websockets.cpp.o -MF
test/CMakeFiles/malloy-tests.dir/test_suites/components/websockets.cpp.o.d -o
test/CMakeFiles/malloy-tests.dir/test_suites/components/websockets.cpp.o -c
/home/ash/sources/malloy/test/test_suites/components/websockets.cpp
during RTL pass: expand
/home/ash/sources/malloy/test/test_suites/components/websockets.cpp: In
function ‘void
{anonymous}::_ZN12_GLOBAL__N_122client_ws_handler_coroILb0EEEN5boost4asio9awaitableIvNS2_15any_io_executorEEENS1_6system10error_codeESt10shared_ptrIN6malloy9websocket10connectionILb1EEEE.actor({anonymous}::client_ws_handler_coro<false>(malloy::error_code,
std::shared_ptr<malloy::websocket::connection<true>
>)::_ZN12_GLOBAL__N_122client_ws_handler_coroILb0EEEN5boost4asio9awaitableIvNS2_15any_io_executorEEENS1_6system10error_codeESt10shared_ptrIN6malloy9websocket10connectionILb1EEEE.frame*)’:
/home/ash/sources/malloy/test/test_suites/components/websockets.cpp:51:5:
internal compiler error: in make_decl_rtl, at varasm.c:1422
   51 |     }
      |     ^
0x1797368 internal_error(char const*, ...)
        ???:0
0x67f8f9 fancy_abort(char const*, int, char const*)
        ???:0
0xa1cdef expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ???:0
0xa1bad9 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ???:0
0xa26f9f store_expr(tree_node*, rtx_def*, int, bool, bool)
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.

-----------
I have attached the .ii file generated. Please let me know if more information
is needed

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/103868] ICE at end of coroutine when using asio
  2021-12-30 14:55 [Bug c++/103868] New: ICE at end of coroutine when using asio ashenglandelbro at protonmail dot com
@ 2021-12-30 14:59 ` ashenglandelbro at protonmail dot com
  2022-01-03  9:43 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ashenglandelbro at protonmail dot com @ 2021-12-30 14:59 UTC (permalink / raw)
  To: 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&action=edit
.ii for the file that failed to compile

Compressed as an xz as the raw text is 8mb

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/103868] ICE at end of coroutine when using asio
  2021-12-30 14:55 [Bug c++/103868] New: ICE at end of coroutine when using asio ashenglandelbro at protonmail dot com
  2021-12-30 14:59 ` [Bug c++/103868] " ashenglandelbro at protonmail dot com
@ 2022-01-03  9:43 ` marxin at gcc dot gnu.org
  2022-01-04  8:31 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-03  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> 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 <marxin at gcc dot gnu.org> ---
I can reproduce it, reducing right now..

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/103868] ICE at end of coroutine when using asio
  2021-12-30 14:55 [Bug c++/103868] New: ICE at end of coroutine when using asio ashenglandelbro at protonmail dot com
  2021-12-30 14:59 ` [Bug c++/103868] " ashenglandelbro at protonmail dot com
  2022-01-03  9:43 ` marxin at gcc dot gnu.org
@ 2022-01-04  8:31 ` marxin at gcc dot gnu.org
  2022-01-04  8:32 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-04  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Created attachment 52116
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52116&action=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<false>(malloy::error_code,
std::shared_ptr<malloy::websocket::connection<true>
>)::_ZN6malloy4test22client_ws_handler_coroILb0EEEN5boost4asio9awaitableIvNS3_15any_io_executorEEENS2_6system10error_codeESt10shared_ptrINS_9websocket10connectionILb1EEEE.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 <https://gcc.gnu.org/bugs/> for instructions.

Note it uses coroutines and -fconcepts.

$ (gdb) p debug_tree(decl)
 <var_decl 0x7ffff7434d80 _Coro_promise
    type <record_type 0x7ffff7462bd0 promise_type sizes-gimplified cxx-odr-p
type_5 type_6 QI
        size <integer_cst 0x7ffff75f3048 constant 8>
        unit-size <integer_cst 0x7ffff75f3060 constant 1>
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff7462b28
        fields <function_decl 0x7ffff7140000 __dt  type <method_type
0x7ffff713b2a0>
            public abstract external autoinline decl_3 decl_8 QI
/tmp/x.ii:982:7 align:16 warn_if_not_align:0 context <record_type
0x7ffff7462b28 awaitable_frame>
            full-name "constexpr boost::asio::detail::awaitable_frame<void,
boost::asio::any_io_executor>::~awaitable_frame() noexcept (<uninstantiated>)"
            not-really-extern chain <function_decl 0x7ffff7140200 __dt_base >>
context <namespace_decl 0x7ffff7338e40 detail>
        full-name "std::__n4861::coroutine_traits<boost::asio::awaitable<void>,
boost::system::error_code, std::shared_ptr<malloy::websocket::connection<true>
> >::promise_type"
        X() X(constX&) this=(X&) n_parents=1 use_template=1 interface-unknown
        pointer_to_this <pointer_type 0x7ffff7469498> chain <type_decl
0x7ffff7450d10 awaitable_frame>>
    addressable used read QI /tmp/x.ii:1035:70 size <integer_cst 0x7ffff75f3048
8> unit-size <integer_cst 0x7ffff75f3060 1>
    align:8 warn_if_not_align:0>
$1 = void

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/103868] ICE at end of coroutine when using asio
  2021-12-30 14:55 [Bug c++/103868] New: ICE at end of coroutine when using asio ashenglandelbro at protonmail dot com
                   ` (2 preceding siblings ...)
  2022-01-04  8:31 ` marxin at gcc dot gnu.org
@ 2022-01-04  8:32 ` marxin at gcc dot gnu.org
  2022-04-18 14:05 ` iains at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-04  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> 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 <marxin at gcc dot gnu.org> ---
Likely started with r11-4386-g9e2256dcd481ffe3, it's rejected before the
revision.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/103868] ICE at end of coroutine when using asio
  2021-12-30 14:55 [Bug c++/103868] New: ICE at end of coroutine when using asio ashenglandelbro at protonmail dot com
                   ` (3 preceding siblings ...)
  2022-01-04  8:32 ` marxin at gcc dot gnu.org
@ 2022-04-18 14:05 ` iains at gcc dot gnu.org
  2022-04-28 12:51 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: iains at gcc dot gnu.org @ 2022-04-18 14:05 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |iains at gcc dot gnu.org

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/103868] ICE at end of coroutine when using asio
  2021-12-30 14:55 [Bug c++/103868] New: ICE at end of coroutine when using asio ashenglandelbro at protonmail dot com
                   ` (4 preceding siblings ...)
  2022-04-18 14:05 ` iains at gcc dot gnu.org
@ 2022-04-28 12:51 ` cvs-commit at gcc dot gnu.org
  2022-04-28 12:58 ` iains at gcc dot gnu.org
  2023-05-29 10:06 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-28 12:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

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

commit r12-8307-g9cb1f565a91e2dd57098c43593954b57c065a19b
Author: Nathan Sidwell <nathan@acm.org>
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 <iain@sandoe.co.uk>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/103868] ICE at end of coroutine when using asio
  2021-12-30 14:55 [Bug c++/103868] New: ICE at end of coroutine when using asio ashenglandelbro at protonmail dot com
                   ` (5 preceding siblings ...)
  2022-04-28 12:51 ` cvs-commit at gcc dot gnu.org
@ 2022-04-28 12:58 ` iains at gcc dot gnu.org
  2023-05-29 10:06 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: iains at gcc dot gnu.org @ 2022-04-28 12:58 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.4

--- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> ---
fixed for gcc-12, back port pending for 11.4.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/103868] ICE at end of coroutine when using asio
  2021-12-30 14:55 [Bug c++/103868] New: ICE at end of coroutine when using asio ashenglandelbro at protonmail dot com
                   ` (6 preceding siblings ...)
  2022-04-28 12:58 ` iains at gcc dot gnu.org
@ 2023-05-29 10:06 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-29 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.4                        |11.5

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.4 is being released, retargeting bugs to GCC 11.5.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-05-29 10:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-30 14:55 [Bug c++/103868] New: ICE at end of coroutine when using asio ashenglandelbro at protonmail dot com
2021-12-30 14:59 ` [Bug c++/103868] " ashenglandelbro at protonmail dot com
2022-01-03  9:43 ` marxin at gcc dot gnu.org
2022-01-04  8:31 ` marxin at gcc dot gnu.org
2022-01-04  8:32 ` marxin at gcc dot gnu.org
2022-04-18 14:05 ` iains at gcc dot gnu.org
2022-04-28 12:51 ` cvs-commit at gcc dot gnu.org
2022-04-28 12:58 ` iains at gcc dot gnu.org
2023-05-29 10:06 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).