https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91222
--- Comment #25 from Jan Hubicka <hubicka at ucw dot cz> --- > --- Comment #24 from ktkachov at gcc dot gnu.org --- > Thanks. Unfortunately I still see the ICE building 507.cactuBSSN_r on aarch64 > with -flto in the same place: > 995 gcc_assert (TYPE_NAME (t1) > 996 && TREE_CODE (TYPE_NAME (t1)) == TYPE_DECL); Sorry to hear that seems cactusBSSN triggers a lot of interesting behaviour here. This conditional should fix it. Index: ipa-devirt.c =================================================================== --- ipa-devirt.c (revision 276420) +++ ipa-devirt.c (working copy) @@ -986,8 +986,8 @@ warn_types_mismatch (tree t1, tree t2, l || (type_with_linkage_p (TYPE_MAIN_VARIANT (t2)) && type_in_anonymous_namespace_p (TYPE_MAIN_VARIANT (t2)))) { - if (type_with_linkage_p (TYPE_MAIN_VARIANT (t1)) - && !type_in_anonymous_namespace_p (TYPE_MAIN_VARIANT (t1))) + if (!type_with_linkage_p (TYPE_MAIN_VARIANT (t1)) + || !type_in_anonymous_namespace_p (TYPE_MAIN_VARIANT (t1))) { std::swap (t1, t2); std::swap (loc_t1, loc_t2);