public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
@ 2022-06-13 18:25 msc at linux dot ibm.com
2022-06-13 18:32 ` [Bug c++/105956] " mpolacek at gcc dot gnu.org
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: msc at linux dot ibm.com @ 2022-06-13 18:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
Bug ID: 105956
Summary: internal compiler error: in
iterative_hash_template_arg, at cp/pt.cc:1819
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msc at linux dot ibm.com
Target Milestone: ---
Bumped into this error while compiling boost.fiber with upstream GCC:
$ git gcc-descr HEAD
r12-9379-g1158fe43407568
$ "/tmp/gcc-install/bin/gcc" -freport-bug -fvisibility-inlines-hidden -fPIC
-m64 -pthread -O0 -fno-inline -Wall -g -fvisibility=hidden
-DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_DYN_LINK=1 -DBOOST_FIBERS_DYN_LINK=1
-DBOOST_FIBERS_SOURCE -DBOOST_FILESYSTEM_DYN_LINK=1 -I"../../.." -c -o
"../../../bin.v2/libs/fiber/build/gcc-custom/debug/threading-multi/visibility-hidden/scheduler.o"
"../../../libs/fiber/src/scheduler.cpp"
In file included from ../../../boost/intrusive/options.hpp:19,
from ../../../boost/intrusive/list_hook.hpp:22,
from ../../../boost/intrusive/list.hpp:20,
from ../../../boost/fiber/scheduler.hpp:17,
from ../../../libs/fiber/src/scheduler.cpp:7:
../../../boost/intrusive/pack_options.hpp: In instantiation of ‘struct
boost::intrusive::invert_typelist_impl<boost::intrusive::typelist<boost::intrusive::slist_defaults,
boost::intrusive::member_hook<boost::fibers::waker_with_hook,
boost::intrusive::slist_member_hook<>,
&boost::fibers::waker_with_hook::waker_queue_hook_>,
boost::intrusive::constant_time_size<false>, boost::intrusive::cache_last<true>
>, boost::intrusive::index_tuple<0, 1, 2, 3> >’:
../../../boost/intrusive/pack_options.hpp:190:71: required from ‘struct
boost::intrusive::invert_typelist<boost::intrusive::typelist<boost::intrusive::slist_defaults,
boost::intrusive::member_hook<boost::fibers::waker_with_hook,
boost::intrusive::slist_member_hook<>,
&boost::fibers::waker_with_hook::waker_queue_hook_>,
boost::intrusive::constant_time_size<false>, boost::intrusive::cache_last<true>
> >’
../../../boost/intrusive/pack_options.hpp:230:55: required from ‘struct
boost::intrusive::pack_options<boost::intrusive::slist_defaults,
boost::intrusive::member_hook<boost::fibers::waker_with_hook,
boost::intrusive::slist_member_hook<>,
&boost::fibers::waker_with_hook::waker_queue_hook_>,
boost::intrusive::constant_time_size<false>, boost::intrusive::cache_last<true>
>’
../../../boost/intrusive/slist.hpp:2149:15: required from ‘struct
boost::intrusive::make_slist<boost::fibers::waker_with_hook,
boost::intrusive::member_hook<boost::fibers::waker_with_hook,
boost::intrusive::slist_member_hook<>,
&boost::fibers::waker_with_hook::waker_queue_hook_>,
boost::intrusive::constant_time_size<false>, boost::intrusive::cache_last<true>
>’
../../../boost/intrusive/slist.hpp:2173:7: required from ‘class
boost::intrusive::slist<boost::fibers::waker_with_hook,
boost::intrusive::member_hook<boost::fibers::waker_with_hook,
boost::intrusive::slist_member_hook<>,
&boost::fibers::waker_with_hook::waker_queue_hook_>,
boost::intrusive::constant_time_size<false>, boost::intrusive::cache_last<true>
>’
../../../boost/fiber/waker.hpp:73:36: required from here
../../../boost/intrusive/pack_options.hpp:164:29: internal compiler error: in
iterative_hash_template_arg, at cp/pt.cc:1819
164 | static const std::size_t last_idx = sizeof_typelist<Typelist>::value
- 1;
| ^~~~~~~~
0x6ec942 iterative_hash_template_arg(tree_node*, unsigned int)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:1819
0xb105c5 iterative_hash_template_arg(tree_node*, unsigned int)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:1829
0xb10fc8 hash_tmpl_and_args
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:1769
0xb10fc8 spec_hasher::hash(tree_node*, tree_node*)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:1776
0xb3389b tsubst_decl
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:14991
0xb26d87 tsubst_copy
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:17066
0xb2a720 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:21390
0xb2a2f6 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:20434
0xb2bb15 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:20283
0xb35d08 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:19595
0xb4b4dc tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:13580
0xb54d8f tsubst_aggr_type
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:13796
0xb54d8f tsubst_aggr_type
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:13753
0xb49154 tsubst(tree_node*, tree_node*, int, tree_node*)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:16282
0xb35497 gen_elem_of_pack_expansion_instantiation
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:12749
0xb35497 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:13417
0xb4b6e2 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:13566
0xb4b905 tsubst_argument_pack(tree_node*, tree_node*, int, tree_node*)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:13517
0xb4b6b4 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:13578
0xb54d8f tsubst_aggr_type
/home/mscastanho/dev/gcc/gcc/cp/pt.cc:13796
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Preprocessed source stored into /tmp/ccVLIwjb.out file, please attach this to
your bugreport.
I'm not that familiar with the code to be able to create a smaller reproducer,
but I'm attaching the pre-processed source generated by -freport-bug.
I was able to reproduce this both on ppc64le and x86_64. GCC configured with:
<gcc-path>/configure --prefix=/tmp/gcc-install --enable-languages=c,c++
--disable-bootstrap --disable-multilib
After doing a quick bisect I suspect the issue was introduced by the following
commit:
commit cb7fd1ea85feea7ef65328330fc2577a95e99400
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Jun 10 16:09:48 2022 -0400
c++: optimize specialization of nested templated classes
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
@ 2022-06-13 18:32 ` mpolacek at gcc dot gnu.org
2022-06-13 18:37 ` msc at linux dot ibm.com
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-06-13 18:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I don't actually see the pre-processed source, can you attach it?
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
2022-06-13 18:32 ` [Bug c++/105956] " mpolacek at gcc dot gnu.org
@ 2022-06-13 18:37 ` msc at linux dot ibm.com
2022-06-13 18:38 ` msc at linux dot ibm.com
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: msc at linux dot ibm.com @ 2022-06-13 18:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
--- Comment #2 from Matheus Castanho <msc at linux dot ibm.com> ---
Created attachment 53129
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53129&action=edit
pre-processed source generated by -freport-bug
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
2022-06-13 18:32 ` [Bug c++/105956] " mpolacek at gcc dot gnu.org
2022-06-13 18:37 ` msc at linux dot ibm.com
@ 2022-06-13 18:38 ` msc at linux dot ibm.com
2022-06-13 18:42 ` [Bug c++/105956] [13 Regression] " mpolacek at gcc dot gnu.org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: msc at linux dot ibm.com @ 2022-06-13 18:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
--- Comment #3 from Matheus Castanho <msc at linux dot ibm.com> ---
Sorry, looks like the original file was too large and didn't get attached when
I created the bug. I attached a gzip compressed version now.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] [13 Regression] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
` (2 preceding siblings ...)
2022-06-13 18:38 ` msc at linux dot ibm.com
@ 2022-06-13 18:42 ` mpolacek at gcc dot gnu.org
2022-06-13 20:40 ` mpolacek at gcc dot gnu.org
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-06-13 18:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Target Milestone|--- |13.0
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2022-06-13
Summary|internal compiler error: in |[13 Regression] internal
|iterative_hash_template_arg |compiler error: in
|, at cp/pt.cc:1819 |iterative_hash_template_arg
| |, at cp/pt.cc:1819
Priority|P3 |P1
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thanks, reproduced.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] [13 Regression] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
` (3 preceding siblings ...)
2022-06-13 18:42 ` [Bug c++/105956] [13 Regression] " mpolacek at gcc dot gnu.org
@ 2022-06-13 20:40 ` mpolacek at gcc dot gnu.org
2022-06-19 18:43 ` ppalka at gcc dot gnu.org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-06-13 20:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
So far reduced to
template <int...> struct index_tuple;
template <unsigned long, typename = index_tuple<>> struct build_number_seq;
template <unsigned long Num, int... Indexes>
struct build_number_seq<Num, index_tuple<Indexes...>>
: build_number_seq<Num - 1, index_tuple<sizeof...(Indexes)>> {};
template <int... Indexes> struct build_number_seq<0, index_tuple<Indexes...>> {
typedef index_tuple<Indexes...> type;
};
template <class> struct typelist;
template <int, typename> struct typelist_element;
template <typename Head, typename... Tail>
struct typelist_element<0, typelist<Head, Tail...>> {
typedef Head type;
};
template <class> struct sizeof_typelist;
template <class... Types> struct sizeof_typelist<typelist<Types...>> {
static const long value = sizeof...(Types);
};
template <class, class> struct invert_typelist_impl;
template <class Typelist, int... Ints>
struct invert_typelist_impl<Typelist, index_tuple<Ints...>> {
static const long last_idx = sizeof_typelist<Typelist>::value - 1;
typedef typelist<
typename typelist_element<last_idx - Ints, Typelist>::type...>
type;
};
template <class> struct invert_typelist;
template <class... Types> struct invert_typelist<typelist<Types...>> {
typedef typename invert_typelist_impl<
typelist<Types...>,
typename build_number_seq<sizeof...(Types)>::type>::type type;
};
template <class> struct do_pack;
struct hook_defaults;
typedef do_pack<invert_typelist<typelist<hook_defaults>>::type> type;
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] [13 Regression] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
` (4 preceding siblings ...)
2022-06-13 20:40 ` mpolacek at gcc dot gnu.org
@ 2022-06-19 18:43 ` ppalka at gcc dot gnu.org
2022-06-20 10:30 ` marxin at gcc dot gnu.org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-06-19 18:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] [13 Regression] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
` (5 preceding siblings ...)
2022-06-19 18:43 ` ppalka at gcc dot gnu.org
@ 2022-06-20 10:30 ` marxin at gcc dot gnu.org
2022-06-20 12:57 ` marxin at gcc dot gnu.org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-06-20 10:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Note I see the same error for inkscape package.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] [13 Regression] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
` (6 preceding siblings ...)
2022-06-20 10:30 ` marxin at gcc dot gnu.org
@ 2022-06-20 12:57 ` marxin at gcc dot gnu.org
2022-06-27 9:03 ` marxin at gcc dot gnu.org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-06-20 12:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
And I reduced to the pretty same code snippet as Marek did.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] [13 Regression] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
` (7 preceding siblings ...)
2022-06-20 12:57 ` marxin at gcc dot gnu.org
@ 2022-06-27 9:03 ` marxin at gcc dot gnu.org
2022-07-05 12:53 ` ppalka at gcc dot gnu.org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-06-27 9:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nyh at math dot technion.ac.il
--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
*** Bug 106087 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] [13 Regression] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
` (8 preceding siblings ...)
2022-06-27 9:03 ` marxin at gcc dot gnu.org
@ 2022-07-05 12:53 ` ppalka at gcc dot gnu.org
2022-07-07 20:49 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-07-05 12:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |byteslice at airmail dot cc
--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 106152 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] [13 Regression] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
` (9 preceding siblings ...)
2022-07-05 12:53 ` ppalka at gcc dot gnu.org
@ 2022-07-07 20:49 ` cvs-commit at gcc dot gnu.org
2022-07-07 20:53 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-07 20:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:7b90f07f778caa5e09f3dc20a8c3da1f4cf60c20
commit r13-1565-g7b90f07f778caa5e09f3dc20a8c3da1f4cf60c20
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Jul 7 16:46:29 2022 -0400
c++: generic targs and identity substitution [PR105956]
In r13-1045-gcb7fd1ea85feea I assumed that substitution into generic
DECL_TI_ARGS corresponds to an identity mapping of the given arguments,
and hence its safe to always elide such substitution. But this PR
demonstrates that such a substitution isn't always the identity mapping,
in particular when there's an ARGUMENT_PACK_SELECT argument, which gets
handled specially during substitution:
* when substituting an APS into a template parameter, we strip the
APS to its underlying argument;
* and when substituting an APS into a pack expansion, we strip the
APS to its underlying argument pack.
In this testcase, when expanding the pack expansion pattern (idx + Ns)...
with Ns={0,1}, we specialize idx twice, first with Ns=APS<0,{0,1}> and
then Ns=APS<1,{0,1}>. The DECL_TI_ARGS of idx are the generic template
arguments of the enclosing class template impl, so before r13-1045,
we'd substitute into its DECL_TI_ARGS which gave Ns={0,1} as desired.
But after r13-1045, we elide this substitution and end up attempting to
hash the original Ns argument, an APS, which ICEs.
So this patch reverts that part of r13-1045. I considered using
preserve_args in this case instead, but that'd break the static_assert
in the testcase because preserve_args always strips APS to its
underlying argument, but here we want to strip it to its underlying
argument pack, so we'd incorrectly end up forming the specializations
impl<0>::idx and impl<1>::idx instead of impl<0,1>::idx.
Although we can't elide the substitution into DECL_TI_ARGS in light of
ARGUMENT_PACK_SELECT, it should still be safe to elide template argument
coercion in the case of a non-template decl, which this patch preserves.
It's unfortunate that we need to remove this optimization just because
it doesn't hold for one special tree code. So this patch implements a
heuristic in tsubst_template_args to avoid allocating a new TREE_VEC if
the substituted elements are identical to those of a level from ARGS, as
well as a similar heuristic for tsubst_argument_pack. It turns out that
about 40% of all calls to tsubst_template_args benefit from this, and it
reduces memory usage by about 4% for e.g. range-v3's zip.cpp (relative to
r13-1045) which more than makes up for the reversion.
PR c++/105956
gcc/cp/ChangeLog:
* pt.cc (template_arg_to_parm): Define.
(tsubst_argument_pack): Try to reuse the corresponding
ARGUMENT_PACK from 'args' when substituting into a generic
ARGUMENT_PACK for a variadic template parameter.
(tsubst_template_args): Move variable declarations closer to
their first use. Replace 'orig_t' with 'r'. Rename 'need_new'
to 'const_subst_p'. Heuristically detect if the substituted
elements are identical to that of a level from 'args' and avoid
allocating a new TREE_VEC if so. Add sanity check for the
length of the new TREE_VEC, and remove dead ARGUMENT_PACK_P test.
(tsubst_decl) <case TYPE_DECL, case VAR_DECL>: Revert
r13-1045-gcb7fd1ea85feea change for avoiding substitution into
DECL_TI_ARGS, but still avoid coercion in this case.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/variadic183.C: New test.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] [13 Regression] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
` (10 preceding siblings ...)
2022-07-07 20:49 ` cvs-commit at gcc dot gnu.org
@ 2022-07-07 20:53 ` ppalka at gcc dot gnu.org
2022-07-23 11:33 ` herrtimson at yahoo dot de
2022-07-25 6:53 ` marxin at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-07-07 20:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #11 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] [13 Regression] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
` (11 preceding siblings ...)
2022-07-07 20:53 ` ppalka at gcc dot gnu.org
@ 2022-07-23 11:33 ` herrtimson at yahoo dot de
2022-07-25 6:53 ` marxin at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: herrtimson at yahoo dot de @ 2022-07-23 11:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
--- Comment #12 from tt_1 <herrtimson at yahoo dot de> ---
may I ask kindly - this was seemingly reported with a git version of gcc-12, so
is there still a need for backporting the fix to that branch as well?
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/105956] [13 Regression] internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
` (12 preceding siblings ...)
2022-07-23 11:33 ` herrtimson at yahoo dot de
@ 2022-07-25 6:53 ` marxin at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-07-25 6:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105956
--- Comment #13 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to tt_1 from comment #12)
> may I ask kindly - this was seemingly reported with a git version of gcc-12,
> so is there still a need for backporting the fix to that branch as well?
No, only the master branch was affected.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2022-07-25 6:53 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13 18:25 [Bug c++/105956] New: internal compiler error: in iterative_hash_template_arg, at cp/pt.cc:1819 msc at linux dot ibm.com
2022-06-13 18:32 ` [Bug c++/105956] " mpolacek at gcc dot gnu.org
2022-06-13 18:37 ` msc at linux dot ibm.com
2022-06-13 18:38 ` msc at linux dot ibm.com
2022-06-13 18:42 ` [Bug c++/105956] [13 Regression] " mpolacek at gcc dot gnu.org
2022-06-13 20:40 ` mpolacek at gcc dot gnu.org
2022-06-19 18:43 ` ppalka at gcc dot gnu.org
2022-06-20 10:30 ` marxin at gcc dot gnu.org
2022-06-20 12:57 ` marxin at gcc dot gnu.org
2022-06-27 9:03 ` marxin at gcc dot gnu.org
2022-07-05 12:53 ` ppalka at gcc dot gnu.org
2022-07-07 20:49 ` cvs-commit at gcc dot gnu.org
2022-07-07 20:53 ` ppalka at gcc dot gnu.org
2022-07-23 11:33 ` herrtimson at yahoo dot de
2022-07-25 6:53 ` marxin at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).