public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98570] New: ICE: canonical types differ for identical types
@ 2021-01-06 17:19 acoplan at gcc dot gnu.org
2021-01-06 17:35 ` [Bug c++/98570] [8/9/10/11 Regression] " mpolacek at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-01-06 17:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98570
Bug ID: 98570
Summary: ICE: canonical types differ for identical types
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
GCC ICEs on the following (on at least aarch64 and x86). The testcase was
reduced from polymake and is accepted by clang.
template <int a> struct b { static constexpr int c = a; };
template <int> struct h { typedef int d; };
template <bool e, typename> using f = typename h<e>::d;
namespace g {
template <typename...> using i = b<false>;
using j = long;
}
using g::i;
using g::j;
template <typename> using k = i<>;
template <typename... l> f<!i<l...>::c, j> m();
template <typename... n> f<!i<k<n>...>::c, j> m();
On AArch64, I can reproduce the ICE back to GCC 6. To reproduce:
$ aarch64-elf-gcc -c testcase.ii
testcase.ii:12:49: internal compiler error: canonical types differ for
identical types 'h<(! g::i<k<n>...>::c)>' and 'h<(! g::i<l ...>::c)>'
12 | template <typename... n> f<!i<k<n>...>::c, j> m();
| ^
0x9f85e5 comptypes(tree_node*, tree_node*, int)
/home/alecop01/toolchain/src/gcc/gcc/cp/typeck.c:1543
0x9f9900 same_type_ignoring_top_level_qualifiers_p(tree_node*, tree_node*)
/home/alecop01/toolchain/src/gcc/gcc/cp/typeck.c:1579
0x9f7827 structural_comptypes
/home/alecop01/toolchain/src/gcc/gcc/cp/typeck.c:1423
0x9f8570 comptypes(tree_node*, tree_node*, int)
/home/alecop01/toolchain/src/gcc/gcc/cp/typeck.c:1532
0x7b9309 decls_match(tree_node*, tree_node*, bool)
/home/alecop01/toolchain/src/gcc/gcc/cp/decl.c:1026
0x7b983c decls_match(tree_node*, tree_node*, bool)
/home/alecop01/toolchain/src/gcc/gcc/cp/decl.c:1080
0x7bacf8 duplicate_decls(tree_node*, tree_node*, bool, bool)
/home/alecop01/toolchain/src/gcc/gcc/cp/decl.c:1459
0x8aed4d do_pushdecl
/home/alecop01/toolchain/src/gcc/gcc/cp/name-lookup.c:3734
0x8b13cc do_pushdecl_with_scope
/home/alecop01/toolchain/src/gcc/gcc/cp/name-lookup.c:4881
0x8b1533 pushdecl_namespace_level(tree_node*, bool)
/home/alecop01/toolchain/src/gcc/gcc/cp/name-lookup.c:6245
0x97701e push_template_decl(tree_node*, bool)
/home/alecop01/toolchain/src/gcc/gcc/cp/pt.c:6049
0x7d1839 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
/home/alecop01/toolchain/src/gcc/gcc/cp/decl.c:5531
0x8fc85e cp_parser_init_declarator
/home/alecop01/toolchain/src/gcc/gcc/cp/parser.c:21659
0x8ff1fb cp_parser_single_declaration
/home/alecop01/toolchain/src/gcc/gcc/cp/parser.c:30427
0x8ff2f8 cp_parser_template_declaration_after_parameters
/home/alecop01/toolchain/src/gcc/gcc/cp/parser.c:29999
0x8ffc2d cp_parser_explicit_template_declaration
/home/alecop01/toolchain/src/gcc/gcc/cp/parser.c:30265
0x8ffc2d cp_parser_template_declaration_after_export
/home/alecop01/toolchain/src/gcc/gcc/cp/parser.c:30284
0x90026a cp_parser_template_declaration
/home/alecop01/toolchain/src/gcc/gcc/cp/parser.c:16533
0x909dcd cp_parser_declaration
/home/alecop01/toolchain/src/gcc/gcc/cp/parser.c:14009
0x908f3b cp_parser_toplevel_declaration
/home/alecop01/toolchain/src/gcc/gcc/cp/parser.c:14107
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98570] [8/9/10/11 Regression] ICE: canonical types differ for identical types
2021-01-06 17:19 [Bug c++/98570] New: ICE: canonical types differ for identical types acoplan at gcc dot gnu.org
@ 2021-01-06 17:35 ` mpolacek at gcc dot gnu.org
2021-01-14 11:18 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-01-06 17:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98570
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=83529
CC| |mpolacek at gcc dot gnu.org
Target Milestone|--- |8.5
Ever confirmed|0 |1
Summary|ICE: canonical types differ |[8/9/10/11 Regression] ICE:
|for identical types |canonical types differ for
| |identical types
Last reconfirmed| |2021-01-06
Status|UNCONFIRMED |NEW
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed, started with r226990, so not a dup of bug 83529.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98570] [8/9/10/11 Regression] ICE: canonical types differ for identical types
2021-01-06 17:19 [Bug c++/98570] New: ICE: canonical types differ for identical types acoplan at gcc dot gnu.org
2021-01-06 17:35 ` [Bug c++/98570] [8/9/10/11 Regression] " mpolacek at gcc dot gnu.org
@ 2021-01-14 11:18 ` rguenth at gcc dot gnu.org
2021-01-22 16:05 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-14 11:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98570
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++/98570] [8/9/10/11 Regression] ICE: canonical types differ for identical types
2021-01-06 17:19 [Bug c++/98570] New: ICE: canonical types differ for identical types acoplan at gcc dot gnu.org
2021-01-06 17:35 ` [Bug c++/98570] [8/9/10/11 Regression] " mpolacek at gcc dot gnu.org
2021-01-14 11:18 ` rguenth at gcc dot gnu.org
@ 2021-01-22 16:05 ` jakub at gcc dot gnu.org
2021-01-22 16:19 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-22 16:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98570
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I don't see how that commit could have changed the behavior.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98570] [8/9/10/11 Regression] ICE: canonical types differ for identical types
2021-01-06 17:19 [Bug c++/98570] New: ICE: canonical types differ for identical types acoplan at gcc dot gnu.org
` (2 preceding siblings ...)
2021-01-22 16:05 ` jakub at gcc dot gnu.org
@ 2021-01-22 16:19 ` mpolacek at gcc dot gnu.org
2021-01-27 20:31 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-01-22 16:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98570
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Maybe it was r226992 and our bisect binaries are broken :/.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98570] [8/9/10/11 Regression] ICE: canonical types differ for identical types
2021-01-06 17:19 [Bug c++/98570] New: ICE: canonical types differ for identical types acoplan at gcc dot gnu.org
` (3 preceding siblings ...)
2021-01-22 16:19 ` mpolacek at gcc dot gnu.org
@ 2021-01-27 20:31 ` jason at gcc dot gnu.org
2021-01-28 15:17 ` ppalka at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2021-01-27 20:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98570
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Status|NEW |ASSIGNED
CC| |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98570] [8/9/10/11 Regression] ICE: canonical types differ for identical types
2021-01-06 17:19 [Bug c++/98570] New: ICE: canonical types differ for identical types acoplan at gcc dot gnu.org
` (4 preceding siblings ...)
2021-01-27 20:31 ` jason at gcc dot gnu.org
@ 2021-01-28 15:17 ` ppalka at gcc dot gnu.org
2021-02-01 14:50 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-01-28 15:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98570
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
FWIW, here's a slightly more reduced ICE-on-valid testcase:
template <bool> struct h {};
struct b { static constexpr int c = true; };
template <class...> using i = b;
template <class... Ts> h<i<Ts...>::c> m();
template <class> using k = bool;
template <class... Ts> h<i<k<Ts>...>::c> m();
Bisection to r7-7375 as the commit that introduced the ICE for this particular
testcase.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98570] [8/9/10/11 Regression] ICE: canonical types differ for identical types
2021-01-06 17:19 [Bug c++/98570] New: ICE: canonical types differ for identical types acoplan at gcc dot gnu.org
` (5 preceding siblings ...)
2021-01-28 15:17 ` ppalka at gcc dot gnu.org
@ 2021-02-01 14:50 ` cvs-commit at gcc dot gnu.org
2021-02-01 15:10 ` jason at gcc dot gnu.org
2021-02-03 17:51 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-01 14:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98570
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:6e0a231a4aa2407bb7167daf98a37795a67364d8
commit r11-7011-g6e0a231a4aa2407bb7167daf98a37795a67364d8
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jan 27 17:15:39 2021 -0500
c++: alias in qualified-id in template arg [PR98570]
template_args_equal has handled dependent alias specializations for a
while,
but in this testcase the actual template argument is a SCOPE_REF, so we
called cp_tree_equal, which doesn't handle aliases specially when we get to
them.
This patch generalizes this by setting a flag so structural_comptypes will
check for template alias equivalence (if we aren't doing partial ordering).
The existing flag, comparing_specializations, was too broad; in particular,
when we're doing decls_match, we want to treat corresponding parameters as
equivalent, so we need to separate that from alias comparison. So I
introduce the comparing_dependent_aliases flag.
From looking at other uses of comparing_specializations, it seems to me
that
the new flag is what modules wants, as well.
The other use of comparing_specializations in structural_comptypes is a
hack
to deal with spec_hasher::equal not calling push_to_top_level, which we
also don't want to tie to the alias comparison semantics.
This patch also changes how we get to structural comparison of aliases from
checking TYPE_CANONICAL in comptypes to marking the aliases as getting
structural comparison when they are built, which is more consistent with
how
e.g. typename is handled.
As I mention in the comment for comparing_dependent_aliases, I think the
default should be to treat different dependent aliases for the same type as
distinct, only treating them as equal during deduction (particularly
partial
ordering). But that's a matter for the C++ committee, to try in stage 1.
gcc/cp/ChangeLog:
PR c++/98570
* cp-tree.h: Declare it.
* pt.c (comparing_dependent_aliases): New flag.
(template_args_equal, spec_hasher::equal): Set it.
(dependent_alias_template_spec_p): Assert that we don't
get non-types other than error_mark_node.
(instantiate_alias_template): SET_TYPE_STRUCTURAL_EQUALITY
on complex alias specializations. Set TYPE_DEPENDENT_P here.
(tsubst_decl): Not here.
* module.cc (module_state::read_cluster): Set
comparing_dependent_aliases instead of
comparing_specializations.
* tree.c (cp_tree_equal): Remove comparing_specializations
module handling.
* typeck.c (structural_comptypes): Adjust.
(comptypes): Remove comparing_specializations handling.
gcc/testsuite/ChangeLog:
PR c++/98570
* g++.dg/cpp0x/alias-decl-targ1.C: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98570] [8/9/10/11 Regression] ICE: canonical types differ for identical types
2021-01-06 17:19 [Bug c++/98570] New: ICE: canonical types differ for identical types acoplan at gcc dot gnu.org
` (6 preceding siblings ...)
2021-02-01 14:50 ` cvs-commit at gcc dot gnu.org
@ 2021-02-01 15:10 ` jason at gcc dot gnu.org
2021-02-03 17:51 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2021-02-01 15:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98570
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|8.5 |11.0
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for GCC 11. Since older releases only ICE with checking enabled, there
seems no need to backport.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/98570] [8/9/10/11 Regression] ICE: canonical types differ for identical types
2021-01-06 17:19 [Bug c++/98570] New: ICE: canonical types differ for identical types acoplan at gcc dot gnu.org
` (7 preceding siblings ...)
2021-02-01 15:10 ` jason at gcc dot gnu.org
@ 2021-02-03 17:51 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-03 17:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98570
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:5c62e4f255bfac65e18213fd93ee1c9908b4a750
commit r11-7089-g5c62e4f255bfac65e18213fd93ee1c9908b4a750
Author: Jason Merrill <jason@redhat.com>
Date: Wed Feb 3 00:29:00 2021 -0500
c++: Fix alias comparison [PR98926]
The comparison of dependent aliases wasn't working here because
processing_template_decl wasn't set, so dependent_alias_template_spec_p was
always returning false.
gcc/cp/ChangeLog:
PR c++/98926
PR c++/98570
* pt.c (spec_hasher::equal): Set processing_template_decl.
* Make-lang.in (check-g++-strict-gc): Add --param
hash-table-verification-limit=10000.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alias-decl-dr1558.C: Pass --param
hash-table-verification-limit=10000.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-02-03 17:51 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 17:19 [Bug c++/98570] New: ICE: canonical types differ for identical types acoplan at gcc dot gnu.org
2021-01-06 17:35 ` [Bug c++/98570] [8/9/10/11 Regression] " mpolacek at gcc dot gnu.org
2021-01-14 11:18 ` rguenth at gcc dot gnu.org
2021-01-22 16:05 ` jakub at gcc dot gnu.org
2021-01-22 16:19 ` mpolacek at gcc dot gnu.org
2021-01-27 20:31 ` jason at gcc dot gnu.org
2021-01-28 15:17 ` ppalka at gcc dot gnu.org
2021-02-01 14:50 ` cvs-commit at gcc dot gnu.org
2021-02-01 15:10 ` jason at gcc dot gnu.org
2021-02-03 17:51 ` cvs-commit 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).