https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91576
--- Comment #16 from Jan Hubicka <hubicka at gcc dot gnu.org> --- OK, i get an ICE because type is not compatible with its main variant. the two types are: <record_type 0x7ffff6fc05e8 _Rb_tree_impl addressable cxx-odr-p BLK size <integer_cst 0x7ffff72e0be8 type <integer_type 0x7ffff70fc0a8 bitsizetype> constant 384> unit-size <integer_cst 0x7ffff72e09f0 type <integer_type 0x7ffff70fc000 sizetype> constant 48> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff6f913f0 fields <field_decl 0x7ffff6fc1260 D.5938 type <record_type 0x7ffff6fc02a0 _Rb_tree_key_compare addressable cxx-odr-p BLK size <integer_cst 0x7ffff70e7c90 constant 8> unit-size <integer_cst 0x7ffff70e7ca8 constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff6f91348 attributes <tree_list 0x7ffff6ef80c8 purpose <identifier_node 0x7ffff6ef80a0 abi_tag> value <tree_list 0x7ffff6ef8078 value <string_cst 0x7ffff72ddbc0 type <array_type 0x7ffff6efa150> readonly constant static "cxx11\000">>> fields <field_decl 0x7ffff6fc1428 _M_key_compare> context <namespace_decl 0x7ffff6ef18e8 std>> ignored BLK files/file3.ii:47:0 size <integer_cst 0x7ffff70e7c90 8> unit-size <integer_cst 0x7ffff70e7ca8 1> align:8 warn_if_not_align:0 offset_align 128 offset <integer_cst 0x7ffff70e7bd0 constant 0> bit-offset <integer_cst 0x7ffff70e7c18 constant 0> context <record_type 0x7ffff6fc05e8 _Rb_tree_impl> chain <field_decl 0x7ffff6fc11c8 D.5937 type <record_type 0x7ffff6f911f8 _Rb_tree_header> ignored BLK files/file3.ii:47:0 size <integer_cst 0x7ffff72e05e8 constant 320> unit-size <integer_cst 0x7ffff72e0648 constant 40> align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst 0x7ffff70e7bd0 0> bit-offset <integer_cst 0x7ffff70e7ba0 constant 64> context <record_type 0x7ffff6fc05e8 _Rb_tree_impl>>> context <record_type 0x7ffff6fc0690 _Rb_tree> pointer_to_this <pointer_type 0x7ffff6fead20>> and <record_type 0x7ffff6f913f0 _Rb_tree_impl addressable cxx-odr-p BLK size <integer_cst 0x7ffff72e0be8 type <integer_type 0x7ffff70fc0a8 bitsizetype> constant 384> unit-size <integer_cst 0x7ffff72e09f0 type <integer_type 0x7ffff70fc000 sizetype> constant 48> align:64 warn_if_not_align:0 symtab:0 alias-set 74 canonical-type 0x7ffff6f913f0 fields <field_decl 0x7ffff6f902f8 D.5493 type <record_type 0x7ffff6f91348 _Rb_tree_key_compare cxx-odr-p QI size <integer_cst 0x7ffff70e7c90 constant 8> unit-size <integer_cst 0x7ffff70e7ca8 constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set 75 canonical-type 0x7ffff6f91348 attributes <tree_list 0x7ffff6ef80c8 purpose <identifier_node 0x7ffff6ef80a0 abi_tag> value <tree_list 0x7ffff6ef8078 value <string_cst 0x7ffff72ddbc0 type <array_type 0x7ffff6efa150> readonly constant static "cxx11\000">>> fields <field_decl 0x7ffff6f90000 _M_key_compare> context <namespace_decl 0x7ffff6ef18e8 std>> ignored QI files/file2.ii:46:0 size <integer_cst 0x7ffff70e7c90 8> unit-size <integer_cst 0x7ffff70e7ca8 1> align:8 warn_if_not_align:0 offset_align 128 offset <integer_cst 0x7ffff70e7bd0 constant 0> bit-offset <integer_cst 0x7ffff70e7c18 constant 0> context <record_type 0x7ffff6f913f0 _Rb_tree_impl> chain <field_decl 0x7ffff6f90260 D.5492 type <record_type 0x7ffff6f911f8 _Rb_tree_header> ignored BLK files/file2.ii:46:0 size <integer_cst 0x7ffff72e05e8 constant 320> unit-size <integer_cst 0x7ffff72e0648 constant 40> align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst 0x7ffff70e7bd0 0> bit-offset <integer_cst 0x7ffff70e7ba0 constant 64> context <record_type 0x7ffff6f913f0 _Rb_tree_impl>>> context <record_type 0x7ffff6f91498 _Rb_tree>> and the reason for incompatibilty is TYPE_MODE here: (gdb) p debug_tree ((tree)0x7ffff6f91348) <record_type 0x7ffff6f91348 _Rb_tree_key_compare cxx-odr-p QI size <integer_cst 0x7ffff70e7c90 type <integer_type 0x7ffff70fc0a8 bitsizetype> constant 8> unit-size <integer_cst 0x7ffff70e7ca8 type <integer_type 0x7ffff70fc000 sizetype> constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set 75 canonical-type 0x7ffff6f91348 attributes <tree_list 0x7ffff6ef80c8 purpose <identifier_node 0x7ffff6ef80a0 abi_tag> value <tree_list 0x7ffff6ef8078 value <string_cst 0x7ffff72ddbc0 type <array_type 0x7ffff6efa150> readonly constant static "cxx11\000">>> fields <field_decl 0x7ffff6f90000 _M_key_compare type <record_type 0x7ffff6f912a0 less cxx-odr-p QI size <integer_cst 0x7ffff70e7c90 8> unit-size <integer_cst 0x7ffff70e7ca8 1> align:8 warn_if_not_align:0 symtab:0 alias-set 76 canonical-type 0x7ffff6f912a0 attributes <tree_list 0x7ffff6ef80c8> context <namespace_decl 0x7ffff6ef18e8 std>> nonlocal QI files/file2.ii:46:475 size <integer_cst 0x7ffff70e7c90 8> unit-size <integer_cst 0x7ffff70e7ca8 1> align:8 warn_if_not_align:0 offset_align 128 offset <integer_cst 0x7ffff70e7bd0 constant 0> bit-offset <integer_cst 0x7ffff70e7c18 constant 0> context <record_type 0x7ffff6f91348 _Rb_tree_key_compare>> context <namespace_decl 0x7ffff6ef18e8 std>> $7 = void (gdb) p debug_tree ((tree)0x7ffff6fc02a0) <record_type 0x7ffff6fc02a0 _Rb_tree_key_compare addressable cxx-odr-p BLK size <integer_cst 0x7ffff70e7c90 type <integer_type 0x7ffff70fc0a8 bitsizetype> constant 8> unit-size <integer_cst 0x7ffff70e7ca8 type <integer_type 0x7ffff70fc000 sizetype> constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff6f91348 attributes <tree_list 0x7ffff6ef80c8 purpose <identifier_node 0x7ffff6ef80a0 abi_tag> value <tree_list 0x7ffff6ef8078 value <string_cst 0x7ffff72ddbc0 type <array_type 0x7ffff6efa150> readonly constant static "cxx11\000">>> fields <field_decl 0x7ffff6fc1428 _M_key_compare type <record_type 0x7ffff6f912a0 less cxx-odr-p QI size <integer_cst 0x7ffff70e7c90 8> unit-size <integer_cst 0x7ffff70e7ca8 1> align:8 warn_if_not_align:0 symtab:0 alias-set 76 canonical-type 0x7ffff6f912a0 attributes <tree_list 0x7ffff6ef80c8> context <namespace_decl 0x7ffff6ef18e8 std>> nonlocal QI files/file3.ii:47:471 size <integer_cst 0x7ffff70e7c90 8> unit-size <integer_cst 0x7ffff70e7ca8 1> align:8 warn_if_not_align:0 offset_align 128 offset <integer_cst 0x7ffff70e7bd0 constant 0> bit-offset <integer_cst 0x7ffff70e7c18 constant 0> context <record_type 0x7ffff6fc02a0 _Rb_tree_key_compare>> context <namespace_decl 0x7ffff6ef18e8 std>> So they are indeed not compatible. We do not detect any ODR violation on them.