public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter
@ 2021-08-12 17:12 reichelt at gcc dot gnu.org
2021-08-12 20:28 ` [Bug c++/101886] " pinskia at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: reichelt at gcc dot gnu.org @ 2021-08-12 17:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101886
Bug ID: 101886
Summary: [11/12 Regression][concepts] ICE with auto as template
parameter
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
Target Milestone: ---
The following valid code snippet (compiled with "-fconcepts")
triggers an ICE since GCC 11.1.0:
========================================
template<typename...> struct A { };
A<int, int> a;
A<auto, auto> b1 = a;
A<auto, auto> b2 = a;
========================================
bug.cc:5:13: internal compiler error: same canonical type node for different
types 'auto' and 'auto'
5 | A<auto, auto> b2 = a;
| ^
0xb4eb9d comptypes(tree_node*, tree_node*, int)
../../gcc-11.1.0/gcc/cp/typeck.c:1565
0xab322f template_args_equal(tree_node*, tree_node*, bool)
../../gcc-11.1.0/gcc/cp/pt.c:9231
0xb42e41 cp_tree_equal(tree_node*, tree_node*)
../../gcc-11.1.0/gcc/cp/tree.c:4079
0xab305a template_args_equal(tree_node*, tree_node*, bool)
../../gcc-11.1.0/gcc/cp/pt.c:9249
0xab2d88 template_args_equal(tree_node*, tree_node*, bool)
../../gcc-11.1.0/gcc/cp/pt.c:9194
0xab2d88 comp_template_args(tree_node*, tree_node*, tree_node**, tree_node**,
bool)
../../gcc-11.1.0/gcc/cp/pt.c:9278
0xab2d88 comp_template_args(tree_node*, tree_node*, tree_node**, tree_node**,
bool)
../../gcc-11.1.0/gcc/cp/pt.c:9258
0xabc9f3 spec_hasher::equal(spec_entry*, spec_entry*)
../../gcc-11.1.0/gcc/cp/pt.c:1727
0xb02944 hash_table<spec_hasher, false,
xcallocator>::find_with_hash(spec_entry* const&, unsigned int)
../../gcc-11.1.0/gcc/hash-table.h:923
0xaeef47 lookup_template_class_1
../../gcc-11.1.0/gcc/cp/pt.c:9889
0xaf0bfc lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc-11.1.0/gcc/cp/pt.c:10244
0xb1914b finish_template_type(tree_node*, tree_node*, int)
../../gcc-11.1.0/gcc/cp/semantics.c:3581
0xa8a8eb cp_parser_template_id
../../gcc-11.1.0/gcc/cp/parser.c:17486
0xa8aadb cp_parser_class_name
../../gcc-11.1.0/gcc/cp/parser.c:24722
0xa81fda cp_parser_qualifying_entity
../../gcc-11.1.0/gcc/cp/parser.c:7002
0xa81fda cp_parser_nested_name_specifier_opt
../../gcc-11.1.0/gcc/cp/parser.c:6684
0xaa2e18 cp_parser_template_introduction
../../gcc-11.1.0/gcc/cp/parser.c:30254
0xaa50c3 cp_parser_declaration
../../gcc-11.1.0/gcc/cp/parser.c:14149
0xaa5e4c cp_parser_toplevel_declaration
../../gcc-11.1.0/gcc/cp/parser.c:14183
0xaa5e4c cp_parser_translation_unit
../../gcc-11.1.0/gcc/cp/parser.c:4942
Please submit a full bug report, [etc.]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/101886] [11/12 Regression][concepts] ICE with auto as template parameter
2021-08-12 17:12 [Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter reichelt at gcc dot gnu.org
@ 2021-08-12 20:28 ` pinskia at gcc dot gnu.org
2021-08-13 7:49 ` [Bug c++/101886] [11/12 Regression][concepts] ICE with auto as template parameter since r11-7011-g6e0a231a4aa2407b marxin at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-12 20:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101886
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/101886] [11/12 Regression][concepts] ICE with auto as template parameter since r11-7011-g6e0a231a4aa2407b
2021-08-12 17:12 [Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter reichelt at gcc dot gnu.org
2021-08-12 20:28 ` [Bug c++/101886] " pinskia at gcc dot gnu.org
@ 2021-08-13 7:49 ` marxin at gcc dot gnu.org
2022-01-17 13:54 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-08-13 7:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101886
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Summary|[11/12 |[11/12
|Regression][concepts] ICE |Regression][concepts] ICE
|with auto as template |with auto as template
|parameter |parameter since
| |r11-7011-g6e0a231a4aa2407b
Last reconfirmed| |2021-08-13
Ever confirmed|0 |1
CC| |jason at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-7011-g6e0a231a4aa2407b.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/101886] [11/12 Regression][concepts] ICE with auto as template parameter since r11-7011-g6e0a231a4aa2407b
2021-08-12 17:12 [Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter reichelt at gcc dot gnu.org
2021-08-12 20:28 ` [Bug c++/101886] " pinskia at gcc dot gnu.org
2021-08-13 7:49 ` [Bug c++/101886] [11/12 Regression][concepts] ICE with auto as template parameter since r11-7011-g6e0a231a4aa2407b marxin at gcc dot gnu.org
@ 2022-01-17 13:54 ` rguenth at gcc dot gnu.org
2022-03-27 17:53 ` [Bug c++/101886] [11/12 Regression][concepts] ICE with auto as template argument " jason at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-17 13:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101886
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/101886] [11/12 Regression][concepts] ICE with auto as template argument since r11-7011-g6e0a231a4aa2407b
2021-08-12 17:12 [Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter reichelt at gcc dot gnu.org
` (2 preceding siblings ...)
2022-01-17 13:54 ` rguenth at gcc dot gnu.org
@ 2022-03-27 17:53 ` jason at gcc dot gnu.org
2022-04-21 7:50 ` [Bug c++/101886] [11/12 Regression][concepts TS] " rguenth at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2022-03-27 17:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101886
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
This use of 'auto' was not accepted into C++20, so fixing this bug in the
vestigial Concepts TS implementation is a low priority.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/101886] [11/12 Regression][concepts TS] ICE with auto as template argument since r11-7011-g6e0a231a4aa2407b
2021-08-12 17:12 [Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter reichelt at gcc dot gnu.org
` (3 preceding siblings ...)
2022-03-27 17:53 ` [Bug c++/101886] [11/12 Regression][concepts] ICE with auto as template argument " jason at gcc dot gnu.org
@ 2022-04-21 7:50 ` rguenth at gcc dot gnu.org
2022-12-19 20:39 ` [Bug c++/101886] [11/12/13 " cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21 7:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101886
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.3 |11.4
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/101886] [11/12/13 Regression][concepts TS] ICE with auto as template argument since r11-7011-g6e0a231a4aa2407b
2021-08-12 17:12 [Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter reichelt at gcc dot gnu.org
` (4 preceding siblings ...)
2022-04-21 7:50 ` [Bug c++/101886] [11/12 Regression][concepts TS] " rguenth at gcc dot gnu.org
@ 2022-12-19 20:39 ` cvs-commit at gcc dot gnu.org
2022-12-19 20:40 ` [Bug c++/101886] [11/12 " ppalka at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-19 20:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101886
--- Comment #4 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:a7c8036b26082d8da001e05596777c5f911590e1
commit r13-4799-ga7c8036b26082d8da001e05596777c5f911590e1
Author: Patrick Palka <ppalka@redhat.com>
Date: Mon Dec 19 14:59:43 2022 -0500
c++: ICE with concepts TS multiple auto deduction [PR101886]
In extract_autos_r, we need to recompute TYPE_CANONICAL for the template
type parameter after adjusting its index, otherwise we end up with a
comptypes ICE for the below testcase. Note that such in-place type
adjustment isn't generally safe to do since the type could be the
TYPE_CANONICAL of another (unadjusted) type, but in this case the
canonical auto (of some level and 0 index) is the first auto (of that
level) that's created, and so any auto that we do end up adjusting can't
be the canonical one.
PR c++/101886
gcc/cp/ChangeLog:
* pt.cc (extract_autos_r): Recompute TYPE_CANONICAL after
adjusting the template type parameter's index. Simplify
by using TEMPLATE_TYPE_IDX. Add some sanity checks.
gcc/testsuite/ChangeLog:
* g++.dg/concepts/auto5.C: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/101886] [11/12 Regression][concepts TS] ICE with auto as template argument since r11-7011-g6e0a231a4aa2407b
2021-08-12 17:12 [Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter reichelt at gcc dot gnu.org
` (5 preceding siblings ...)
2022-12-19 20:39 ` [Bug c++/101886] [11/12/13 " cvs-commit at gcc dot gnu.org
@ 2022-12-19 20:40 ` ppalka at gcc dot gnu.org
2022-12-20 22:02 ` cvs-commit at gcc dot gnu.org
2023-02-25 16:34 ` ppalka at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-19 20:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101886
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Summary|[11/12/13 |[11/12 Regression][concepts
|Regression][concepts TS] |TS] ICE with auto as
|ICE with auto as template |template argument since
|argument since |r11-7011-g6e0a231a4aa2407b
|r11-7011-g6e0a231a4aa2407b |
CC| |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/101886] [11/12 Regression][concepts TS] ICE with auto as template argument since r11-7011-g6e0a231a4aa2407b
2021-08-12 17:12 [Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter reichelt at gcc dot gnu.org
` (6 preceding siblings ...)
2022-12-19 20:40 ` [Bug c++/101886] [11/12 " ppalka at gcc dot gnu.org
@ 2022-12-20 22:02 ` cvs-commit at gcc dot gnu.org
2023-02-25 16:34 ` ppalka at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-20 22:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101886
--- Comment #5 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:8aa045c97485d75e0b6eb1068464c0ddaa6beacb
commit r13-4810-g8aa045c97485d75e0b6eb1068464c0ddaa6beacb
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Dec 20 17:02:37 2022 -0500
c++, tree: walk TREE_VEC (and VECTOR_CST) in natural order [PR101886]
Unfortunately the extract_autos_r fix in r13-4799-ga7c8036b26082d is
derailed by the fact that walk_tree_1 currently walks the elements of a
TREE_VEC in reverse, which means for A<auto, auto> in the below testcase
extract_autos_r ends up adjusting the TEMPLATE_TYPE_IDX of the first
auto instead of the second one, and the first auto is the canonical auto
of level 2 (and index 0), so we rightfully trigger the sanity check
added in that commit.
It seems TREE_VEC and VECTOR_CST are the only trees we walk in reverse,
and this has been the case since r21884 whence the original version of
walk_tree_1 was introduced. But that's arguably unnatural and not
consistent with how we walk all other compound trees such as CONSTRUCTORs
and EXPR_P trees in forward order.
So this patch makes walk_tree_1 walk TREE_VEC (and VECTOR_CST) in
forward order as well, which fixes the testcase. Doing so revealed that
keep_template_parm grows the list of found template parameters from the
front, which previously compensated for the TREE_VEC behavior, so now we
should grow it from the back.
PR c++/101886
gcc/cp/ChangeLog:
* pt.cc (find_template_parameter_info::parm_list_tail):
New data member.
(keep_template_parm): Use parm_list_tail to append rather
than prepend to parm_list.
gcc/ChangeLog:
* tree.cc (walk_tree_1) <case TREE_VEC>: Walk the elements
in forward instead of reverse order.
<case VECTOR_CST>: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/concepts/diagnostic12.C: Adjust expected order of
template parameters within pretty printed parameter mapping.
* g++.dg/concepts/auto6.C: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/101886] [11/12 Regression][concepts TS] ICE with auto as template argument since r11-7011-g6e0a231a4aa2407b
2021-08-12 17:12 [Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter reichelt at gcc dot gnu.org
` (7 preceding siblings ...)
2022-12-20 22:02 ` cvs-commit at gcc dot gnu.org
@ 2023-02-25 16:34 ` ppalka at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-02-25 16:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101886
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|11.4 |13.0
Status|ASSIGNED |RESOLVED
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 13, this doesn't seem worth backporting since the bug is Concepts
TS specific.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-02-25 16:34 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 17:12 [Bug c++/101886] New: [11/12 Regression][concepts] ICE with auto as template parameter reichelt at gcc dot gnu.org
2021-08-12 20:28 ` [Bug c++/101886] " pinskia at gcc dot gnu.org
2021-08-13 7:49 ` [Bug c++/101886] [11/12 Regression][concepts] ICE with auto as template parameter since r11-7011-g6e0a231a4aa2407b marxin at gcc dot gnu.org
2022-01-17 13:54 ` rguenth at gcc dot gnu.org
2022-03-27 17:53 ` [Bug c++/101886] [11/12 Regression][concepts] ICE with auto as template argument " jason at gcc dot gnu.org
2022-04-21 7:50 ` [Bug c++/101886] [11/12 Regression][concepts TS] " rguenth at gcc dot gnu.org
2022-12-19 20:39 ` [Bug c++/101886] [11/12/13 " cvs-commit at gcc dot gnu.org
2022-12-19 20:40 ` [Bug c++/101886] [11/12 " ppalka at gcc dot gnu.org
2022-12-20 22:02 ` cvs-commit at gcc dot gnu.org
2023-02-25 16:34 ` ppalka 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).