public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "slyfox at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-101715-4-Dnjd7xCPd7@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-101715-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101715 --- Comment #15 from Sergei Trofimovich <slyfox at gcc dot gnu.org> --- 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 <class A> struct S { S<A> & bar() noexcept(A::value); S<A> & foo() noexcept(A::value); }; template <class A> S<A> & S<A>::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=c++14 $ g++-12.0.0 -c a.c.cpp -std=c++17 a.c.cpp:6:56: internal compiler error: canonical types differ for identical types 'S<A>& (S<A>::)() noexcept (A::value)' and 'S<A>& (S<A>::)() noexcept (A::value)' 6 | template <class A> S<A> & S<A>::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 <https://gcc.gnu.org/bugs/> for instructions. Poking at the internals: (gdb) fr 1 #1 0x0000000000c3f6ef in comptypes (t1=0x7fffea3791f8, t2=0x7fffea3627e0, strict=<optimized out>) 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::<T385> (struct S *) (gdb) call debug_generic_expr(t2) struct S & S::<T37d> (struct S *) (gdb) call debug_tree(t1) <method_type 0x7fffea3791f8 type <reference_type 0x7fffea3629d8 type <record_type 0x7fffea362930 S cxx-odr-p type_0 type_5 type_6 VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea362c78 context <translation_unit_decl 0x7fffea220168 a.c.cpp> full-name "struct S<A>" no-binfo use_template=1 interface-unknown reference_to_this <reference_type 0x7fffea3629d8> chain <type_decl 0x7fffea241b48 S>> unsigned DI size <integer_cst 0x7fffea212f48 constant 64> unit-size <integer_cst 0x7fffea212f60 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea362f18> QI size <integer_cst 0x7fffea234048 type <integer_type 0x7fffea2320a8 bitsizetype> constant 8> unit-size <integer_cst 0x7fffea234060 type <integer_type 0x7fffea232000 sizetype> constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea3627e0 method basetype <record_type 0x7fffea362c78 S> arg-types <tree_list 0x7fffea378438 value <pointer_type 0x7fffea362dc8 type <record_type 0x7fffea362c78 S> unsigned DI size <integer_cst 0x7fffea212f48 64> unit-size <integer_cst 0x7fffea212f60 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea362dc8> chain <tree_list 0x7fffea228b68 value <void_type 0x7fffea232f18 void>>> throws <tree_list 0x7fffea378410 purpose <scope_ref 0x7fffea3783e8 tree_0 arg:0 <template_type_parm 0x7fffea362888 A> arg:1 <identifier_node 0x7fffea22e4c0 value normal local bindings <(nil)>> a.c.cpp:6:51 start: a.c.cpp:6:51 finish: a.c.cpp:6:55>>> (gdb) call debug_tree(t2) <method_type 0x7fffea3627e0 type <reference_type 0x7fffea362f18 type <record_type 0x7fffea362c78 S cxx-odr-p type_0 type_5 type_6 VOID size <integer_cst 0x7fffea212fc0 constant 0> unit-size <integer_cst 0x7fffea212f78 constant 0> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea362c78 fields <using_decl 0x7fffea241a18 operator=> context <translation_unit_decl 0x7fffea220168 a.c.cpp> full-name "struct S<A>" n_parents=0 use_template=0 interface-unknown pointer_to_this <pointer_type 0x7fffea362dc8> reference_to_this <reference_type 0x7fffea362f18> chain <type_decl 0x7fffea2418e8 S>> unsigned type_0 type_6 DI size <integer_cst 0x7fffea212f48 constant 64> unit-size <integer_cst 0x7fffea212f60 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea362f18> type_0 type_6 QI size <integer_cst 0x7fffea234048 type <integer_type 0x7fffea2320a8 bitsizetype> constant 8> unit-size <integer_cst 0x7fffea234060 type <integer_type 0x7fffea232000 sizetype> constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea362540 method basetype <record_type 0x7fffea362c78 S> arg-types <tree_list 0x7fffea35cf28 value <pointer_type 0x7fffea362dc8 type <record_type 0x7fffea362c78 S> unsigned DI size <integer_cst 0x7fffea212f48 64> unit-size <integer_cst 0x7fffea212f60 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea362dc8> chain <tree_list 0x7fffea228b68 value <void_type 0x7fffea232f18 void>>> throws <tree_list 0x7fffea378230 purpose <scope_ref 0x7fffea378208 tree_0 arg:0 <template_type_parm 0x7fffea362bd0 A> arg:1 <identifier_node 0x7fffea22e4c0 value normal local bindings <(nil)>> 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=` field while `t2` has.
next prev parent reply other threads:[~2021-12-28 13:46 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-01 17:32 [Bug c++/101715] New: compiler ice when uses a GCC cross compiler to canadian compile LLVM libc++ unlvsur at live dot com 2021-08-01 17:44 ` [Bug c++/101715] " pinskia at gcc dot gnu.org 2021-08-01 19:11 ` unlvsur at live dot com 2021-08-01 19:12 ` unlvsur at live dot com 2021-08-01 20:50 ` pinskia at gcc dot gnu.org 2021-08-01 22:41 ` pinskia at gcc dot gnu.org 2021-08-01 22:43 ` [Bug c++/101715] [11/12 Regression] " pinskia at gcc dot gnu.org 2021-08-01 23:53 ` [Bug c++/101715] [11/12 Regression] ICE with noexcept and canonical types differ for identical types caused by r12-1824 hjl.tools at gmail dot com 2021-08-02 1:58 ` pinskia at gcc dot gnu.org 2021-08-02 8:44 ` rguenth at gcc dot gnu.org 2021-08-02 16:02 ` [Bug c++/101715] [11/12 Regression] ICE with noexcept and canonical types differ for identical types redi at gcc dot gnu.org 2021-08-02 16:38 ` mpolacek at gcc dot gnu.org 2021-11-04 8:52 ` pinskia at gcc dot gnu.org 2021-11-04 8:55 ` marxin at gcc dot gnu.org 2021-11-04 15:01 ` mpolacek at gcc dot gnu.org 2021-11-16 21:34 ` pinskia at gcc dot gnu.org 2021-12-01 9:38 ` pinskia at gcc dot gnu.org 2021-12-28 13:46 ` slyfox at gcc dot gnu.org [this message] 2022-01-13 21:01 ` mpolacek at gcc dot gnu.org 2022-01-15 0:24 ` mpolacek at gcc dot gnu.org 2022-01-15 21:30 ` slyfox at gcc dot gnu.org 2022-01-21 18:12 ` cvs-commit at gcc dot gnu.org 2022-01-21 18:14 ` [Bug c++/101715] [11 " mpolacek at gcc dot gnu.org 2022-01-24 21:26 ` cvs-commit at gcc dot gnu.org 2022-01-24 21:26 ` mpolacek 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-101715-4-Dnjd7xCPd7@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: linkBe 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).