https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104777
Bug ID: 104777 Summary: gcc crashes while compiling a custom coroutine library sample Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: janezz55 at gmail dot com Target Milestone: --- The code sample is here https://github.com/user1095108/cr. gcc crashes only if the optimization level is higher than 2. g++ -I.. -Ofast -no-pie -std=c++20 loop.cpp -o l clang compiles everything without issue. ./lduring RTL pass: sched2 In file included from /usr/include/c++/11.2.0/functional:59, from /usr/include/c++/11.2.0/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/11.2.0/algorithm:74, from loop.hpp:5, from loop.cpp:3: /usr/include/c++/11.2.0/bits/std_function.h: In static member function 'static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Res = void; _Functor = main()::<lambda()>; _ArgTypes = {}]': /usr/include/c++/11.2.0/bits/std_function.h:293:7: internal compiler error: in move_insn, at haifa-sched.c:5471 293 | } | ^ 0xe4c988 internal_error(char const*, ...) ???:0 0xe42d02 fancy_abort(char const*, int, char const*) ???:0 0x13ee792 schedule_block(basic_block_def**, void*) ???:0 0x13da4f2 schedule_insns() ???: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.