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

            Bug ID: 116450
           Summary: ICE in in expand_expr_real_1, at expr.cc:11376
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: indiosmo at gmail dot com
  Target Milestone: ---

Created attachment 58970
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58970&action=edit
preprocessed source

ICE with gcc 14.2.0.
Compiler info, code and output below, but for convenience here's a godbolt link
to reproduce: https://godbolt.org/z/KavcMesas.

GCC 14.1.0 compiles it.


gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/msi/abacus_workspace/gcc-14.2.0/libexec/gcc/x86_64-pc-linux-gnu/14.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-14.2.0/configure
--prefix=/home/msi/cpp_workspace/objdir/../gcc-14.2.0 --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.2.0 (GCC)



Code
```
#include "boost/asio/detached.hpp"
#include "boost/asio/io_context.hpp"
#include "boost/beast/core/tcp_stream.hpp"
#include "boost/beast/websocket/stream.hpp"
#include "boost/cobalt.hpp"

namespace {

using tcp_socket =
boost::cobalt::use_op_t::as_default_on_t<boost::asio::ip::tcp::socket>;
using tcp_acceptor =
boost::cobalt::use_op_t::as_default_on_t<boost::asio::ip::tcp::acceptor>;
using tcp_stream = boost::beast::websocket::stream<boost::beast::tcp_stream>;

class server
{
public:
  void start()
  {
    boost::cobalt::spawn(io_context_, run(), boost::asio::detached);
  }

private:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmismatched-new-delete"

  boost::cobalt::task<void> run()
  {
    // instantiate stream generator
    auto get_stream = accept();

    for (;;) {
      // get a stream
      auto stream = co_await get_stream;
    }

    co_return;
  }

#pragma GCC diagnostic pop

  boost::cobalt::generator<tcp_stream> accept()
  {
    auto executor = co_await boost::cobalt::this_coro::executor;
    auto endpoint =
boost::asio::ip::tcp::endpoint{boost::asio::ip::make_address("0.0.0.0"), 8095};

    tcp_acceptor acceptor{executor, endpoint};
    acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));

    for (;;) {
      tcp_stream stream = tcp_stream{co_await acceptor.async_accept()};
      co_yield std::move(stream);
    }

    co_return tcp_stream{tcp_socket{acceptor.get_executor()}};
  }

  boost::asio::io_context io_context_;
};

} // namespace

int main()
{
  server s{};
  s.start();
  return EXIT_SUCCESS;
}
```



output:
```
/home/msi/abacus_workspace/gcc-14.2.0/bin/g++
-DBOOST_ASIO_CONCURRENCY_HINT_DEFAULT=1 -DBOOST_COBALT_NO_LIB
-DBOOST_LEAF_CFG_GNUC_STMTEXPR=0 -isystem
/home/msi/abacus_workspace/boost_1.86.0/include -g -std=c++23 -Wall -Wextra
-DBOOST_COBALT_NO_PMR -ggdb -fdiagnostics-color=always -fno-strict-aliasing
-fuse-ld=mold -Wl,--no-undefined -fno-omit-frame-pointer
-fconcepts-diagnostics-depth=2 -march=native -Werror -Wnull-dereference
-Wdangling-reference -Wdouble-promotion -Wduplicated-cond -Wduplicated-branches
-Wunused-function -Wlogical-op -Wrestrict -Wpedantic -pedantic-errors
-Wcast-align=strict -Wconversion -Wnrvo -MD -MT
sandbox/CMakeFiles/sandbox.dir/main.cpp.o -MF
sandbox/CMakeFiles/sandbox.dir/main.cpp.o.d -o
sandbox/CMakeFiles/sandbox.dir/main.cpp.o -c
/home/msi/abacus_workspace/abacus2/sandbox/main.cpp
during RTL pass: expand
/home/msi/abacus_workspace/abacus2/sandbox/main.cpp: In member function
‘boost::cobalt::task<void> {anonymous}::server::run()’:
/home/msi/abacus_workspace/abacus2/sandbox/main.cpp:37:3: internal compiler
error: in expand_expr_real_1, at expr.cc:11376
   37 |   }
      |   ^
0x78243e expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc-14.2.0/gcc/expr.cc:11376
0xbc17a9 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
        ../../gcc-14.2.0/gcc/expr.cc:9451
0xbc17a9 expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
        ../../gcc-14.2.0/gcc/expr.h:316
0xbc17a9 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc-14.2.0/gcc/expr.cc:11730
0xbc2864 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
        ../../gcc-14.2.0/gcc/expr.cc:9451
0xbc2864 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc-14.2.0/gcc/expr.cc:11957
0xbcdb84 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
        ../../gcc-14.2.0/gcc/expr.cc:9451
0xbcdb84 store_expr(tree_node*, rtx_def*, int, bool, bool)
        ../../gcc-14.2.0/gcc/expr.cc:6751
0xbd0186 expand_assignment(tree_node*, tree_node*, bool)
        ../../gcc-14.2.0/gcc/expr.cc:6472
0xbd0186 expand_assignment(tree_node*, tree_node*, bool)
        ../../gcc-14.2.0/gcc/expr.cc:5957
0xabac10 expand_gimple_stmt_1
        ../../gcc-14.2.0/gcc/cfgexpand.cc:3998
0xabac10 expand_gimple_stmt
        ../../gcc-14.2.0/gcc/cfgexpand.cc:4077
0xabfbb7 expand_gimple_basic_block
        ../../gcc-14.2.0/gcc/cfgexpand.cc:6133
0xac1b06 execute
        ../../gcc-14.2.0/gcc/cfgexpand.cc:6872
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
```

Reply via email to