summaryrefslogtreecommitdiff
path: root/gcc/ipa-devirt.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2018-10-25 14:18:28 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2018-10-25 12:18:28 +0000
commit09d3f04eaea862476be3c74fd84f06ec1afb1e68 (patch)
tree237bd6c29959d29d83c737b92ba8bf346e4adb03 /gcc/ipa-devirt.c
parent46ec9261008a118470c43d6b7eeb95e4c4b12e67 (diff)
ipa-devirt.c (odr_types_equivalent_p): Do not ICE if one of types is anonymous.
* ipa-devirt.c (odr_types_equivalent_p): Do not ICE if one of types is anonymous. * g++.dg/lto/odr-1_0.C: New test. * g++.dg/lto/odr-1_1.C: New test. From-SVN: r265484
Diffstat (limited to 'gcc/ipa-devirt.c')
-rw-r--r--gcc/ipa-devirt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 9564d651b2b..466b61e5513 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -1265,6 +1265,13 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned,
/* Check first for the obvious case of pointer identity. */
if (t1 == t2)
return true;
+ if ((type_with_linkage_p (t1) && type_in_anonymous_namespace_p (t1))
+ != (type_with_linkage_p (t2) && type_in_anonymous_namespace_p (t2)))
+ {
+ warn_odr (t1, t2, NULL, NULL, warn, warned,
+ G_("one of types is in anonymous namespace while other is not"));
+ return false;
+ }
gcc_assert (!type_with_linkage_p (t1) || !type_in_anonymous_namespace_p (t1));
gcc_assert (!type_with_linkage_p (t2) || !type_in_anonymous_namespace_p (t2));