diff options
author | Martin Liska <mliska@suse.cz> | 2019-11-29 10:03:25 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-11-29 09:03:25 +0000 |
commit | efeeda757691b13e716c6681e7f6af5f85927e92 (patch) | |
tree | 3bfd1d32ae0f121f4e250b339637500eeb449da8 /gcc/ipa-devirt.c | |
parent | d5e82c9f686f6c8e2feabfe753258f9fc13d980f (diff) |
Check for TYPE_NAME in type_with_linkage_p.
2019-11-29 Martin Liska <mliska@suse.cz>
PR lto/91574
* ipa-devirt.c (types_same_for_odr): Check for existence
of TYPE_NAMEs first.
2019-11-29 Martin Liska <mliska@suse.cz>
PR lto/91574
* g++.dg/lto/pr91574_0.C: New test.
From-SVN: r278829
Diffstat (limited to 'gcc/ipa-devirt.c')
-rw-r--r-- | gcc/ipa-devirt.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 0b2475ca292..a884a465a5d 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -356,6 +356,13 @@ types_same_for_odr (const_tree type1, const_tree type2) || (type_with_linkage_p (type2) && type_in_anonymous_namespace_p (type2))) return false; + /* If both type has mangled defined check if they are same. + Watch for anonymous types which are all mangled as "<anon">. */ + if (!type_with_linkage_p (type1) || !type_with_linkage_p (type2)) + return false; + if (type_in_anonymous_namespace_p (type1) + || type_in_anonymous_namespace_p (type2)) + return false; return (DECL_ASSEMBLER_NAME (TYPE_NAME (type1)) == DECL_ASSEMBLER_NAME (TYPE_NAME (type2))); } |