From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AF2333858C60; Tue, 28 Dec 2021 13:46:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF2333858C60 From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101715] [11/12 Regression] ICE with noexcept and canonical types differ for identical types Date: Tue, 28 Dec 2021 13:46:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Dec 2021 13:46:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101715 --- Comment #15 from Sergei Trofimovich --- clang's compiler-rt fails to build for quite a while due to this ICE. Trying to poke at the failure. I shrunk the example slightly further: template struct S { S & bar() noexcept(A::value); S & foo() noexcept(A::value); }; template S & S::foo() noexcept(A::value) {} c++17 seems to be the trigger (perhaps due to noexcept argument type change= ?). Also, if we comment out seemingly unrelated `S::foo()` declaration ICE disappears. Could it be that there is an unexpected type sharing in an uninstantiated type? The backtrace: $ g++-12.0.0 -c a.c.cpp -std=3Dc++14 $ g++-12.0.0 -c a.c.cpp -std=3Dc++17 a.c.cpp:6:56: internal compiler error: canonical types differ for identical types 'S& (S::)() noexcept (A::value)' and 'S& (S::)() noexcept (A::value)' 6 | template S & S::foo() noexcept(A::value) {} | ^ 0xc3f6ee comptypes(tree_node*, tree_node*, int) ../../gcc-12-20211226/gcc/cp/typeck.c:1558 0xa784ce duplicate_decls(tree_node*, tree_node*, bool, bool) ../../gcc-12-20211226/gcc/cp/decl.c:2409 0xa7f2bb grokfndecl ../../gcc-12-20211226/gcc/cp/decl.c:10351 0xa83cf6 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*, decl_context, int, tree_node**) ../../gcc-12-20211226/gcc/cp/decl.c:14154 0xa88196 start_function(cp_decl_specifier_seq*, cp_declarator const*, tree_node*) ../../gcc-12-20211226/gcc/cp/decl.c:17171 0xb82c0f cp_parser_function_definition_from_specifiers_and_declarator ../../gcc-12-20211226/gcc/cp/parser.c:31047 0xb82c0f cp_parser_init_declarator ../../gcc-12-20211226/gcc/cp/parser.c:22520 0xb8a93e cp_parser_single_declaration ../../gcc-12-20211226/gcc/cp/parser.c:31683 0xb8aab6 cp_parser_template_declaration_after_parameters ../../gcc-12-20211226/gcc/cp/parser.c:31243 0xb8b340 cp_parser_explicit_template_declaration ../../gcc-12-20211226/gcc/cp/parser.c:31509 0xb8dcf1 cp_parser_declaration ../../gcc-12-20211226/gcc/cp/parser.c:14849 0xb8e7a2 cp_parser_toplevel_declaration ../../gcc-12-20211226/gcc/cp/parser.c:14939 0xb8e7a2 cp_parser_translation_unit ../../gcc-12-20211226/gcc/cp/parser.c:4987 0xb8e7a2 c_parse_file() ../../gcc-12-20211226/gcc/cp/parser.c:47944 0xcbefcd c_common_parse_file() ../../gcc-12-20211226/gcc/c-family/c-opts.c:1238 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. Poking at the internals: (gdb) fr 1 #1 0x0000000000c3f6ef in comptypes (t1=3D0x7fffea3791f8, t2=3D0x7fffea3627= e0, strict=3D) at ../../gcc-12-20211226/gcc/cp/typeck.c:1557 1557 ../../gcc-12-20211226/gcc/cp/typeck.c: No such file or directory. (gdb) call debug_generic_expr(t1) struct S & S:: (struct S *) (gdb) call debug_generic_expr(t2) struct S & S:: (struct S *) (gdb) call debug_tree(t1) full-name "struct S" no-binfo use_template=3D1 interface-unknown reference_to_this chain > unsigned DI size unit-size align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea362f18> QI size constant 8> unit-size constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea3627e0 method basetype arg-types unsigned DI size unit-size align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-ty= pe 0x7fffea362dc8> chain >> throws arg:1 > a.c.cpp:6:51 start: a.c.cpp:6:51 finish: a.c.cpp:6:55>>> (gdb) call debug_tree(t2) unit-size align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea362c78 fields context full-name "struct S" n_parents=3D0 use_template=3D0 interface-unknown pointer_to_this reference_to_this chain > unsigned type_0 type_6 DI size unit-size align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea362f18> type_0 type_6 QI size constant 8> unit-size constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea362540 method basetype arg-types unsigned DI size unit-size align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-ty= pe 0x7fffea362dc8> chain >> throws arg:1 > a.c.cpp:3:30 start: a.c.cpp:3:30 finish: a.c.cpp:3:34>>> If I read the difference correctly `t1` has no `operator=3D` field while `t= 2` has.=