https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123814
Bug ID: 123814
Summary: ICE in constraint satisfaction for fold expression
(possibly memory corruption)
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: janschultke at googlemail dot com
Target Milestone: ---
Large parts of my code base ICE with GCC 15, with the following minimal repro:
https://godbolt.org/z/T99c3TGqr
The issue goes away when disabling -Wall, so it's somewhere in diagnostics. I
don't think the code necessary is IFNDR, so this should be ice-on-valid.
========================================================================
g++-15 -std=c++23 -Wall -S ice.cpp \
--param ggc-min-expand=0 --param ggc-min-heapsize=0
========================================================================
namespace std {
struct source_location {
struct __impl {
const char *_M_file_name;
const char *_M_function_name;
unsigned _M_line;
unsigned _M_column;
};
static void current(const __impl* = __builtin_source_location());
};
} // namespace std
template <typename> concept same_as = true;
template <typename... Us>
concept one_of = (same_as<Us> || ...);
template <one_of<> T> constexpr int buffer_size_for_int = 0;
template <> constexpr int buffer_size_for_int<int> = 1;
template <int> using Basic_Characters = int;
template <typename T>
Basic_Characters<buffer_size_for_int<T>> to_characters() {
std::source_location::current();
}
void go() {
to_characters<int>();
}
========================================================================
internal compiler error: error reporting routines re-entered.
0x228dbed diagnostic_context::report_diagnostic(diagnostic_info*)
???:0
0x228dd45 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x229eb7f error_at(unsigned long, char const*, ...)
???:0
0x8382eb satisfaction_cache::save(tree_node*)
???:0
0x83dab8 constraints_satisfied_p(tree_node*, tree_node*)
???:0
0x9ba2da finish_template_variable(tree_node*, int)
???:0
0x9ad811 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
???:0
0x9b2b07 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
???:0
0x9abb0b tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x9ac47d tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x22ab533 pretty_printer::format(text_info&)
???:0
0x22ad7b3 pp_verbatim(pretty_printer*, char const*, ...)
???:0
0x229ca38 diagnostic_text_output_format::on_report_diagnostic(diagnostic_info
const&, diagnostic_t)
???:0
0x228d972 diagnostic_context::report_diagnostic(diagnostic_info*)
???:0
0x228dd45 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x229dd4e warning_at(rich_location*, diagnostic_option_id, char const*, ...)
???:0
0x884d00 finish_function(bool)
???:0
0x99fc1f instantiate_decl(tree_node*, bool, bool)
???:0
0x9c6253 instantiate_pending_templates(int)
???:0
0x898dba c_parse_final_cleanups()
???:0