+2019-12-10 Richard Sandiford <richard.sandiford@arm.com>
+
+ * ipa-utils.h (get_odr_name_for_type): Check for a TYPE_DECL.
+ * ipa-devirt.c (warn_types_mismatch): Don't call xstrdup for the
+ second demangled name.
+
2019-12-10 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.c (IX86_LEA_PRIORITY): Fix comment typos.
{
const int opts = DMGL_PARAMS | DMGL_ANSI | DMGL_TYPES;
char *name1 = xstrdup (cplus_demangle (odr1, opts));
- char *name2 = xstrdup (cplus_demangle (odr2, opts));
+ char *name2 = cplus_demangle (odr2, opts);
if (name1 && name2 && strcmp (name1, name2))
{
inform (loc_t1,
{
tree type_name = TYPE_NAME (type);
if (type_name == NULL_TREE
+ || TREE_CODE (type_name) != TYPE_DECL
|| !DECL_ASSEMBLER_NAME_SET_P (type_name))
return NULL;
+2019-12-10 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/lto/tag-1_0.c, gcc.dg/lto/tag-1_1.c: New test.
+
2019-12-10 Jakub Jelinek <jakub@redhat.com>
* gcc.target/i386/avx512f-vmovntpd-2.c: Ensure res is 64-byte aligned.
--- /dev/null
+/* { dg-lto-do link } */
+/* { dg-lto-options { { -Wodr -flto } } } */
+
+struct foo { int x; };
+struct foo a = {};
--- /dev/null
+struct foo { short x; };
+
+extern struct foo a; /* { dg-lto-warning {type of 'a' does not match original declaration} } */
+struct foo *ptr = &a;
+
+int main () { return 0; }