Commit efeeda75 by Martin Liska Committed by Martin Liska

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
parent d5e82c9f
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 Richard Biener <rguenther@suse.de>
PR tree-optimization/92704
......@@ -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)));
}
......
2019-11-29 Martin Liska <mliska@suse.cz>
PR lto/91574
* g++.dg/lto/pr91574_0.C: New test.
2019-11-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/92704
......
// PR lto/91574
// { dg-lto-do link }
// { dg-lto-options { { -fPIC -flto -O2 } } }
// { dg-require-effective-target shared }
// { dg-require-effective-target fpic }
// { dg-extra-ld-options "-shared" }
class A
{
public:
virtual ~A ();
A (A &);
virtual unsigned m_fn1 () const;
};
class B : A
{
unsigned m_fn1 () const;
};
void
fn1 (B p1)
{
B a[]{p1, p1};
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment