https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120602
Bug ID: 120602 Summary: ICE: in pp_string, at pretty-print.cc:2652 Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- Target: x86_64 ******************************************************************************* The compiler produces an internal error during pp_string when compiling the provided code with the specified options. The issue can also be reproduced on Compiler Explorer. ******************************************************************************* OS and Platform: # uname -a Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ******************************************************************************* # gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-250601/libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=/root/gdbtest/gcc/gcc-250601 --enable-languages=c,c++ --disable-multilib --disable-bootstrap Thread model: posix Supported LTO compression algorithms: zlib gcc version 16.0.0 20250601 (experimental) (GCC) ******************************************************************************* Program: #cat code.cpp #include <coroutine> struct dummy_coro { using promise_type = dummy_coro; bool await_ready() { return false; } void await_suspend(std::coroutine_handle<>) { } void await_resume() { } dummy_coro get_return_object() { return {}; } dummy_coro initial_suspend() { return {}; } dummy_coro final_suspend() { return {}; } void return_void() { } void unhandled_exception() { } }; template <int ...I> dummy_coro foo() { ((co_await [](int){ return std::suspend_never{}; }(I)), ...); co_return; } void bar() { foo<1>(); } ******************************************************************************* Command Lines: gcc code.cpp -std=c++20 -pedantic -Wall -Wextra -Werror -O2 -c -o code_0.o in pp_string, at pretty-print.cc:2652 0x282f2e5 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x284d676 internal_error(char const*, ...) ???:0 0xadef02 fancy_abort(char const*, int, char const*) ???:0 0x287b11f pretty_printer::format(text_info&) ???:0 0x287fc23 pp_verbatim(pretty_printer*, char const*, ...) ???:0 0x284ad28 diagnostic_text_output_format::on_report_diagnostic(diagnostic_info const&, diagnostic_t) ???:0 0x282ee36 diagnostic_context::report_diagnostic(diagnostic_info*) ???:0 0x282f2e5 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x284cf5f error_at(unsigned long, char const*, ...) ???:0 0xb7704c cp_coroutine_transform::wrap_original_function_body() ???:0 0xb79591 cp_coroutine_transform::apply_transforms() ???:0 0xbcfff7 finish_function(bool) ???:0 0xd5cb0d instantiate_decl(tree_node*, bool, bool) ???:0 0xd6c102 instantiate_pending_templates(int) ???:0 0xbec841 c_parse_final_cleanups() ???:0 0xe6c5f8 c_common_parse_file() ???:0 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. Compiler returned: 1 ******************************************************************************* Also ICE on trunk, compiler explorer:https://gcc.godbolt.org/z/6s7GeehKr *******************************************************************************