https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109658
Bug ID: 109658
Summary: ICE when building aria2-1.36.0 (internal compiler
error: in instantiate_decl, at cp/pt.cc:27095)
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: sjames at gcc dot gnu.org
Target Milestone: ---
Created attachment 54946
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54946&action=edit
json.ii.xz
Hit this when building aria2-1.36.0:
```
gcc (Gentoo 14.0.0.9999 p, commit 28d2380b495e99daca3b01ca9e6a73a623a2f3d2)
14.0.0 20230427 (experimental) e86d01af7926b04e80d8f3e6409bc67dbff8a069
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```
```
/bin/sh ../libtool --tag=CXX --mode=compile aarch64-unknown-linux-gnu-g++
-DHAVE_CONFIG_H -I. -I.. -I../lib -I../intl -I./includes -I./includes
-DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -pipe -O3 -pipe
-mcpu=native -c -o json.lo json.cc
libtool: compile: aarch64-unknown-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I..
-I../lib -I../intl -I./includes -I./includes -DLOCALEDIR=\"/usr/share/locale\"
-DHAVE_CONFIG_H -pipe -O3 -pipe -mcpu=native -c json.cc -fPIC -DPIC -o
.libs/json.o
In file included from ValueBase.h:45,
from json.h:39,
from json.cc:35:
a2functional.h:106:39: warning: ‘template<class _Arg1, class _Arg2, class
_Result> struct std::binary_function’ is deprecated [-Wdeprecated-declarations]
106 | class LeastRecentAccess : public std::binary_function<T, T, bool> {
| ^~~~~~~~~~~~~~~
In file included from
/usr/lib/gcc/aarch64-unknown-linux-gnu/14/include/g++-v14/string:49,
from ValueBase.h:40:
/usr/lib/gcc/aarch64-unknown-linux-gnu/14/include/g++-v14/bits/stl_function.h:131:12:
note: declared here
131 | struct binary_function
| ^~~~~~~~~~~~~~~
json.h: In instantiation of ‘void aria2::json::encode(OutputStream&, const
aria2::ValueBase*)::JsonValueBaseVisitor::encodeString(const std::string&)
[with OutputStream = std::__cxx11::basic_ostringstream<char>; std::string =
std::__cxx11::basic_string<char>]’:
json.h:56:7: required from ‘void aria2::json::encode(OutputStream&, const
aria2::ValueBase*)::JsonValueBaseVisitor::visit(const aria2::String&) [with
OutputStream = std::__cxx11::basic_ostringstream<char>]’
json.h:111:3: required from ‘OutputStream& aria2::json::encode(OutputStream&,
const aria2::ValueBase*) [with OutputStream =
std::__cxx11::basic_ostringstream<char>]’
json.cc:99:16: required from here
json.h:56:7: internal compiler error: in instantiate_decl, at cp/pt.cc:27095
56 | encodeString(string.s());
| ^~~~~~~~~~~~
0x9bcb1b instantiate_decl(tree_node*, bool, bool)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:27095
0x82f17f mark_used(tree_node*, int)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/decl2.cc:5875
0x9b130b tsubst_baselink
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:16923
0x999ce3 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:21428
0x997a8b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:21035
0x9a7d6b tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:19891
0x9a97d7 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:18868
0x9a903f tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:19220
0x9ba6cf tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:18826
0x9ba6cf instantiate_body
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:26915
0x9bc2cb instantiate_decl(tree_node*, bool, bool)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:27211
0x9a9793 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:19382
0x9a93f7 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:18840
0x9a903f tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:19220
0x9ba6cf tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:18826
0x9ba6cf instantiate_body
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:26915
0x9bc2cb instantiate_decl(tree_node*, bool, bool)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:27211
0x9e8b43 instantiate_pending_templates(int)
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/pt.cc:27289
0x833a97 c_parse_final_cleanups()
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/cp/decl2.cc:4988
0xafcd23 c_common_parse_file()
/usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/c-family/c-opts.cc:1266
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```
`aarch64-unknown-linux-gnu-g++ -O2 -c json.ii` is enough to repro.