summaryrefslogtreecommitdiff
path: root/gcc/lto/lto-symtab.c
diff options
context:
space:
mode:
authorMartin Liska <marxin@gcc.gnu.org>2018-04-10 07:24:59 +0000
committerMartin Liska <marxin@gcc.gnu.org>2018-04-10 07:24:59 +0000
commit8d96e546b765cf7e008584359065651008e728e1 (patch)
treedbdf98e4977a4c4df3bd44bfdcb4fed00ccd3bce /gcc/lto/lto-symtab.c
parentc1b8f25d8090e778b330555005c81bc0c582a6b8 (diff)
Be more carefull about DECL merging in LTO (PR lto/85248).
2018-04-10 Richard Biener <rguenther@suse.de> Martin Liska <mliska@suse.cz> PR lto/85248 * lto-symtab.c (lto_symtab_merge_p): Handle noreturn attribute. 2018-04-10 Jakub Jelinek <jakub@redhat.com> PR lto/85248 * gcc.dg/lto/pr85248_0.c: New test. * gcc.dg/lto/pr85248_1.c: New test. From-SVN: r259265
Diffstat (limited to 'gcc/lto/lto-symtab.c')
-rw-r--r--gcc/lto/lto-symtab.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index 4f186aed059..473c0d0b5af 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -572,6 +572,9 @@ lto_symtab_merge_p (tree prevailing, tree decl)
return false;
}
}
+
+ /* FIXME: after MPX is removed, use flags_from_decl_or_type
+ function instead. PR lto/85248. */
if (DECL_ATTRIBUTES (prevailing) != DECL_ATTRIBUTES (decl))
{
tree prev_attr = lookup_attribute ("error", DECL_ATTRIBUTES (prevailing));
@@ -599,6 +602,19 @@ lto_symtab_merge_p (tree prevailing, tree decl)
"warning attribute mismatch\n");
return false;
}
+
+ prev_attr = lookup_attribute ("noreturn", DECL_ATTRIBUTES (prevailing));
+ attr = lookup_attribute ("noreturn", DECL_ATTRIBUTES (decl));
+ if ((prev_attr == NULL) != (attr == NULL)
+ || (prev_attr
+ && TREE_VALUE (TREE_VALUE (prev_attr))
+ != TREE_VALUE (TREE_VALUE (attr))))
+ {
+ if (symtab->dump_file)
+ fprintf (symtab->dump_file, "Not merging decls; "
+ "noreturn attribute mismatch\n");
+ return false;
+ }
}
return true;
}