public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "acoplan at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/98570] New: ICE: canonical types differ for identical types
Date: Wed, 06 Jan 2021 17:19:27 +0000	[thread overview]
Message-ID: <bug-98570-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2021-01-06 17:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 17:19 acoplan at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-98570-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).