https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118056
Bug ID: 118056
Summary: ICE: tree code ‘template_type_parm’ is not supported
in LTO streams
Product: gcc
Version: 15.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: ---
*******************************************************************************
The compiler produces an internal error during IPA pass: modref 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
*******************************************************************************
# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-241212/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gdbtest/gcc/gcc-241212
--enable-languages=c,c++ --disable-multilib --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20241212 (experimental) (GCC)
*******************************************************************************
Program:
#cat code_0.cpp
#include <cstddef>
#include <utility>
void operate_one(auto&&) {}
void operate_multi(auto&&...args)
{
[&]<std::size_t... idx>(std::index_sequence<idx...>)
{
(::operate_one(args...[idx]), ...);
}(std::make_index_sequence<sizeof...(args)>{});
}
int main()
{
::operate_multi(1, 2, 3);
}
*******************************************************************************
Command Lines:
g++ code_0.cpp -funroll-loops -flto -Wall -Wextra -fno-strict-aliasing
-fwrapv -g -fsanitize=address -c -o code_0.o
==================================
code_0.cpp:4:18: warning: use of ‘auto’ in parameter declaration only available
with ‘-std=c++20’ or ‘-fconcepts’ [-Wc++20-extensions]
4 | void operate_one(auto&&) {}
| ^~~~
code_0.cpp:6:20: warning: use of ‘auto’ in parameter declaration only available
with ‘-std=c++20’ or ‘-fconcepts’ [-Wc++20-extensions]
6 | void operate_multi(auto&&...args)
| ^~~~
code_0.cpp: In lambda function:
code_0.cpp:10:28: warning: pack indexing only available with ‘-std=c++2c’ or
‘-std=gnu++2c’ [-Wc++26-extensions]
10 | (::operate_one(args...[idx]), ...);
| ^~~
during IPA pass: modref
code_0.cpp: At top level:
code_0.cpp:17:1: internal compiler error: tree code ‘template_type_parm’ is not
supported in LTO streams
17 | }
| ^
0x29bfcdf internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:517
0x129f8d8 DFS::DFS(output_block*, tree_node*, bool, bool, bool)
../../gcc/gcc/lto-streamer-out.cc:911
0x12a0def lto_output_tree(output_block*, tree_node*, bool, bool)
../../gcc/gcc/lto-streamer-out.cc:1863
0x129779e write_global_stream
../../gcc/gcc/lto-streamer-out.cc:2879
0x12a3dd8 lto_output_decl_state_streams(output_block*, lto_out_decl_state*)
../../gcc/gcc/lto-streamer-out.cc:2926
0x12a3dd8 produce_asm_for_decls()
../../gcc/gcc/lto-streamer-out.cc:3338
0x133bd1a write_lto
../../gcc/gcc/passes.cc:2795
0x133bd1a ipa_write_summaries_1
../../gcc/gcc/passes.cc:2858
0x133bd1a ipa_write_summaries()
../../gcc/gcc/passes.cc:2914
0xf2d4a9 ipa_passes
../../gcc/gcc/cgraphunit.cc:2274
0xf2d4a9 symbol_table::compile()
../../gcc/gcc/cgraphunit.cc:2349
0xf30247 symbol_table::compile()
../../gcc/gcc/cgraphunit.cc:2327
0xf30247 symbol_table::finalize_compilation_unit()
../../gcc/gcc/cgraphunit.cc:2601
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.
*******************************************************************************
Also ICE on trunk, compiler explorer:https://godbolt.org/z/5fPGTeEMK
*******************************************************************************