public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107539] New: internal compiler error: same canonical type node for different types
@ 2022-11-05 22:10 franckbehaghel_gcc at protonmail dot com
2022-11-05 23:35 ` [Bug c++/107539] " franckbehaghel_gcc at protonmail dot com
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: franckbehaghel_gcc at protonmail dot com @ 2022-11-05 22:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107539
Bug ID: 107539
Summary: internal compiler error: same canonical type node for
different types
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: franckbehaghel_gcc at protonmail dot com
Target Milestone: ---
Created attachment 53835
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53835&action=edit
preprocessed source
When compiling gimp 2.10 with a fresh gcc version :
3ad2167bbac8ae83b1e91305b105ab5287bdac55 , I get the following error :
gimppaintcore-loops.cc: In lambda function:
gimppaintcore-loops.cc:472:61: internal compiler error: same canonical type
node for different types ‘AlgorithmTemplate<typename decltype
(algorithm)::type>’ and ‘AlgorithmTemplate<typename decltype
(algorithm)::type>’
472 | visitor (identity<AlgorithmTemplate<NewAlgorithm>> ());
| ^~
0xc4306c comptypes(tree_node*, tree_node*, int)
/GIT_REPO/build/gcc/gcc/gcc/cp/typeck.cc:1717
0xb99717 template_args_equal(tree_node*, tree_node*, bool)
/GIT_REPO/build/gcc/gcc/gcc/cp/pt.cc:9284
0xb993fc template_args_equal(tree_node*, tree_node*, bool)
/GIT_REPO/build/gcc/gcc/gcc/cp/pt.cc:9247
0xb993fc comp_template_args(tree_node*, tree_node*, tree_node**, tree_node**,
bool)
/GIT_REPO/build/gcc/gcc/gcc/cp/pt.cc:9329
0xba42c3 spec_hasher::equal(spec_entry*, spec_entry*)
/GIT_REPO/build/gcc/gcc/gcc/cp/pt.cc:1668
0xbecf73 hash_table<spec_hasher, false,
xcallocator>::find_with_hash(spec_entry* const&, unsigned int)
/GIT_REPO/build/gcc/gcc/gcc/hash-table.h:926
0xbd4dac lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
/GIT_REPO/build/gcc/gcc/gcc/cp/pt.cc:9945
0xc044ed finish_template_type(tree_node*, tree_node*, int)
/GIT_REPO/build/gcc/gcc/gcc/cp/semantics.cc:3755
0xb6a808 cp_parser_template_id
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:18368
0xb6aaab cp_parser_class_name
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:25826
0xb60f6e cp_parser_qualifying_entity
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:7183
0xb60f6e cp_parser_nested_name_specifier_opt
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:6865
0xb7a848 cp_parser_simple_type_specifier
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:19809
0xb5e98c cp_parser_postfix_expression
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:7640
0xb469bc cp_parser_binary_expression
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:10091
0xb47792 cp_parser_assignment_expression
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:10431
0xb4c9ee cp_parser_parenthesized_expression_list_elt
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:8054
0xb4cfb1 cp_parser_parenthesized_expression_list
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:8523
0xb5ef71 cp_parser_postfix_expression
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:7798
0xb469bc cp_parser_binary_expression
/GIT_REPO/build/gcc/gcc/gcc/cp/parser.cc:10091
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.
To reproduce : g++ -x c++ ccYvosm6.out1
Or copy&paste ccYvosm6.out1 in compiler explorer ( https://godbolt.org/ ).
Similar output is generated.
Regards,
Franck
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/107539] internal compiler error: same canonical type node for different types
2022-11-05 22:10 [Bug c++/107539] New: internal compiler error: same canonical type node for different types franckbehaghel_gcc at protonmail dot com
@ 2022-11-05 23:35 ` franckbehaghel_gcc at protonmail dot com
2022-11-06 6:22 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: franckbehaghel_gcc at protonmail dot com @ 2022-11-05 23:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107539
--- Comment #1 from Franck Behaghel <franckbehaghel_gcc at protonmail dot com> ---
Created attachment 53836
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53836&action=edit
main.cpp
reduced testcase :
g++ main.cpp
main.cpp: In lambda function:
main.cpp:222:61: internal compiler error: same canonical type node for
different types ‘AlgorithmTemplate<typename decltype (algorithm)::type>’ and
‘AlgorithmTemplate<typename decltype (algorithm)::type>’
222 | visitor (identity<AlgorithmTemplate<NewAlgorithm>> ());
| ^~
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/107539] internal compiler error: same canonical type node for different types
2022-11-05 22:10 [Bug c++/107539] New: internal compiler error: same canonical type node for different types franckbehaghel_gcc at protonmail dot com
2022-11-05 23:35 ` [Bug c++/107539] " franckbehaghel_gcc at protonmail dot com
@ 2022-11-06 6:22 ` pinskia at gcc dot gnu.org
2022-11-06 6:32 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-06 6:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107539
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the ICE only shows up with checking enabled. It is definitely a bug but
one which most users won't see.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/107539] internal compiler error: same canonical type node for different types
2022-11-05 22:10 [Bug c++/107539] New: internal compiler error: same canonical type node for different types franckbehaghel_gcc at protonmail dot com
2022-11-05 23:35 ` [Bug c++/107539] " franckbehaghel_gcc at protonmail dot com
2022-11-06 6:22 ` pinskia at gcc dot gnu.org
@ 2022-11-06 6:32 ` pinskia at gcc dot gnu.org
2022-11-06 6:34 ` [Bug c++/107539] [13 Regression] ICE, same canonical type node for different types with decltype inside an generic lambda inside a templated method of a templated class using a templated class argument pinskia at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-06 6:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107539
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 53837
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53837&action=edit
reduced further
Here is even more reduced testcase.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/107539] [13 Regression] ICE, same canonical type node for different types with decltype inside an generic lambda inside a templated method of a templated class using a templated class argument
2022-11-05 22:10 [Bug c++/107539] New: internal compiler error: same canonical type node for different types franckbehaghel_gcc at protonmail dot com
` (2 preceding siblings ...)
2022-11-06 6:32 ` pinskia at gcc dot gnu.org
@ 2022-11-06 6:34 ` pinskia at gcc dot gnu.org
2022-11-21 12:53 ` [Bug c++/107539] [13 Regression] ICE, same canonical type node for different types with decltype inside an generic lambda inside a templated method of a templated class using a templated class argument since r13-737-gd0ef9e06197d14d7 marxin at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-06 6:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107539
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Keywords| |needs-bisection
Last reconfirmed| |2022-11-06
Summary|internal compiler error: |[13 Regression] ICE, same
|same canonical type node |canonical type node for
|for different types |different types with
| |decltype inside an generic
| |lambda inside a templated
| |method of a templated class
| |using a templated class
| |argument
Target Milestone|--- |13.0
Status|UNCONFIRMED |NEW
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
I am not 100% of the summary.
Also I am not 100% sure of it being a 13 regression but GCC 12 compiles this
fine even with -fchecking (GCC 13 compiles it also fine with -fno-checking).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/107539] [13 Regression] ICE, same canonical type node for different types with decltype inside an generic lambda inside a templated method of a templated class using a templated class argument since r13-737-gd0ef9e06197d14d7
2022-11-05 22:10 [Bug c++/107539] New: internal compiler error: same canonical type node for different types franckbehaghel_gcc at protonmail dot com
` (3 preceding siblings ...)
2022-11-06 6:34 ` [Bug c++/107539] [13 Regression] ICE, same canonical type node for different types with decltype inside an generic lambda inside a templated method of a templated class using a templated class argument pinskia at gcc dot gnu.org
@ 2022-11-21 12:53 ` marxin at gcc dot gnu.org
2022-12-01 15:12 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-11-21 12:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107539
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[13 Regression] ICE, same |[13 Regression] ICE, same
|canonical type node for |canonical type node for
|different types with |different types with
|decltype inside an generic |decltype inside an generic
|lambda inside a templated |lambda inside a templated
|method of a templated class |method of a templated class
|using a templated class |using a templated class
|argument |argument since
| |r13-737-gd0ef9e06197d14d7
Keywords|needs-bisection |
CC| |marxin at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r13-737-gd0ef9e06197d14d7.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/107539] [13 Regression] ICE, same canonical type node for different types with decltype inside an generic lambda inside a templated method of a templated class using a templated class argument since r13-737-gd0ef9e06197d14d7
2022-11-05 22:10 [Bug c++/107539] New: internal compiler error: same canonical type node for different types franckbehaghel_gcc at protonmail dot com
` (4 preceding siblings ...)
2022-11-21 12:53 ` [Bug c++/107539] [13 Regression] ICE, same canonical type node for different types with decltype inside an generic lambda inside a templated method of a templated class using a templated class argument since r13-737-gd0ef9e06197d14d7 marxin at gcc dot gnu.org
@ 2022-12-01 15:12 ` ppalka at gcc dot gnu.org
2022-12-02 1:12 ` cvs-commit at gcc dot gnu.org
2022-12-02 1:14 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-01 15:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107539
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] 9+ messages in thread
* [Bug c++/107539] [13 Regression] ICE, same canonical type node for different types with decltype inside an generic lambda inside a templated method of a templated class using a templated class argument since r13-737-gd0ef9e06197d14d7
2022-11-05 22:10 [Bug c++/107539] New: internal compiler error: same canonical type node for different types franckbehaghel_gcc at protonmail dot com
` (5 preceding siblings ...)
2022-12-01 15:12 ` ppalka at gcc dot gnu.org
@ 2022-12-02 1:12 ` cvs-commit at gcc dot gnu.org
2022-12-02 1:14 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-02 1:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107539
--- Comment #6 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:a4e577b044d69977f93b2cb7769dc991eadf2cf0
commit r13-4453-ga4e577b044d69977f93b2cb7769dc991eadf2cf0
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Dec 1 20:11:53 2022 -0500
c++: comptypes ICE with BOUND_TEMPLATE_TEMPLATE_PARMs [PR107539]
Here we end up giving the two BOUND_TEMPLATE_TEMPLATE_PARMs
C<decltype(f::t)> and C<decltype(g::t)> the same TYPE_CANONICAL because
the hash table that interns TYPE_CANONICAL for template type parameters
doesn't set the comparing_specializations flag which controls how
PARM_DECLs from different contexts compare equal.
Later, from spec_hasher::equal for the corresponding two specializations
A<C<decltype(f::t)>> and A<C<decltype(g::t)>>, we compare the two bound
ttps with comparing_specializations set hence they now (structurally)
compare different despite having the same TYPE_CANONICAL, and so we get
the error:
internal compiler error: same canonical type node for different types
'C<decltype (t)>' and 'C<decltype (t)>'
This suggests that we should be setting comparing_specializations from
ctp_hasher::equal to match spec_hasher::equal. But doing so introduces
a separate ICE in cpp2a/concepts-placeholder3.C:
internal compiler error: canonical types differ for identical types
'auto [requires ::same_as<<placeholder>, decltype(f::x)>]' and
'auto [requires ::same_as<<placeholder>, decltype(g::x)>]'
because norm_hasher::equal doesn't set comparing_specializations either.
I'm not sure when exactly we need to set comparing_specializations given
what it controls (TYPENAME_TYPE equality/hashing and PARM_DECL equality)
but it seems to be the conservative choice to set the flag wherever we
have a global hash table that relies on type equality. To that end this
patch sets comparing_specializations in ctp_hasher and norm_hasher, as
well as in atom_hasher and sat_hasher for good measure. This turns out
to be a compile time win of about 2% in some concepts tests, probably
because of the improved TYPENAME_TYPE hashing enabled by the flag.
PR c++/107539
gcc/cp/ChangeLog:
* constraint.cc (norm_hasher::hash, norm_hasher::equal): Set
comparing_specializations.
(sat_hasher::hash, sat_hasher::equal): Likewise.
* cp-tree.h (atom_hasher::hash, atom_hasher::equal): Likewise.
* pt.cc (ctp_hasher::hash, ctp_hasher::equal): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/template/canon-type-19.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/107539] [13 Regression] ICE, same canonical type node for different types with decltype inside an generic lambda inside a templated method of a templated class using a templated class argument since r13-737-gd0ef9e06197d14d7
2022-11-05 22:10 [Bug c++/107539] New: internal compiler error: same canonical type node for different types franckbehaghel_gcc at protonmail dot com
` (6 preceding siblings ...)
2022-12-02 1:12 ` cvs-commit at gcc dot gnu.org
@ 2022-12-02 1:14 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-02 1:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107539
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Should be fixed, thanks for the bug report.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-12-02 1:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-05 22:10 [Bug c++/107539] New: internal compiler error: same canonical type node for different types franckbehaghel_gcc at protonmail dot com
2022-11-05 23:35 ` [Bug c++/107539] " franckbehaghel_gcc at protonmail dot com
2022-11-06 6:22 ` pinskia at gcc dot gnu.org
2022-11-06 6:32 ` pinskia at gcc dot gnu.org
2022-11-06 6:34 ` [Bug c++/107539] [13 Regression] ICE, same canonical type node for different types with decltype inside an generic lambda inside a templated method of a templated class using a templated class argument pinskia at gcc dot gnu.org
2022-11-21 12:53 ` [Bug c++/107539] [13 Regression] ICE, same canonical type node for different types with decltype inside an generic lambda inside a templated method of a templated class using a templated class argument since r13-737-gd0ef9e06197d14d7 marxin at gcc dot gnu.org
2022-12-01 15:12 ` ppalka at gcc dot gnu.org
2022-12-02 1:12 ` cvs-commit at gcc dot gnu.org
2022-12-02 1:14 ` 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).