Bug 103279 - [12 regression] ICE on llvm-compiler-rt-13: internal compiler error: canonical types differ for identical types
Summary: [12 regression] ICE on llvm-compiler-rt-13: internal compiler error: canonica...
Status: RESOLVED DUPLICATE of bug 101715
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2021-11-16 17:54 UTC by Sergei Trofimovich
Modified: 2021-11-16 21:34 UTC (History)
0 users

See Also:
Known to work:
Known to fail:
Last reconfirmed:

a.c.cpp.orig.gz (152.89 KB, application/gzip)
2021-11-16 17:59 UTC, Sergei Trofimovich

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Trofimovich 2021-11-16 17:54:01 UTC
Initially observed ICE on llvm-13's compiler-rt build attempt. cvise managed to reduce it down to:

$ cat a.c.cpp
    template <typename> struct __noexcept_move_assign_container;
    template <class _Allocator> struct basic_string {
      basic_string &operator=(basic_string &&) noexcept(
      basic_string &assign(basic_string &&) noexcept(
    template <class _Allocator>
    basic_string<_Allocator> &
    basic_string<_Allocator>::operator=(basic_string &&) noexcept(
        __noexcept_move_assign_container<_Allocator>::value) {}

$ g++-12.0.0 -O3  -fPIC -fno-exceptions -std=c++20 -c a.c.cpp
a.c.cpp:11:60: internal compiler error: canonical types differ for identical types 'basic_string<_Allocator>& (basic_string<_Allocator>::)(basic_string<_Allocator>&&) noexcept (__noexcept_move_assign_container<_Allocator>::value)' and 'basic_string<_Allocator>& (basic_string<_Allocator>::)(basic_string<_Allocator>&&) noexcept (__noexcept_move_assign_container<_Allocator>::value)'
   11 |         __noexcept_move_assign_container<_Allocator>::value) {}
      |                                                            ^
0x20cfe97 internal_error(char const*, ...)
0xc3166f comptypes(tree_node*, tree_node*, int)
0xa6b3bc duplicate_decls(tree_node*, tree_node*, bool, bool)
0xa778a0 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*, decl_context, int, tree_node**)
0xa7c7c6 start_function(cp_decl_specifier_seq*, cp_declarator const*, tree_node*)
0xb834cd c_parse_file()
0xcb23dd c_common_parse_file()
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.

$ g++-12.0.0 -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211114 (experimental) (GCC)
Comment 1 Sergei Trofimovich 2021-11-16 17:59:38 UTC
Created attachment 51815 [details]

a.c.cpp.orig.gz is an unreduced file in case reduction is too narrow.
Comment 2 Marek Polacek 2021-11-16 18:00:02 UTC
Probably a dup of bug 101715, haven't verified yet.
Comment 3 Andrew Pinski 2021-11-16 21:34:24 UTC
(In reply to Marek Polacek from comment #2)
> Probably a dup of bug 101715, haven't verified yet.

It is a dup.  The noexcept part is the key there.

*** This bug has been marked as a duplicate of bug 101715 ***