Hi,
enabling local aliases on AIX causes few ICEs. This is because localias
function looks
for existing alias. C++ FE produces those for thunk code but doesn't make them
correctly,
so we end up with missing DECL_CONTEXT that later confuses ipa-devirt.
This patch adds sanity checking of the alias (so we won't get fooled by user
aliases)
and I will try to fix the C++ side too (ideally by switchign it to localalias
machinery)
Bootstrapped/regtested rs6000-aix
comitted.
* symtab.c: Include calls.h
(symtab_nonoverwritable_alias_1): Check sanity of the local
alias.
Index: symtab.c
===================================================================
--- symtab.c (revision 212279)
+++ symtab.c (working copy)
@@ -43,6 +43,7 @@
#include "lto-streamer.h"
#include "output.h"
#include "ipa-utils.h"
+#include "calls.h"
static const char *ipa_ref_use_name[] = {"read","write","addr","alias"};
@@ -1727,6 +1728,19 @@
{
if (decl_binds_to_current_def_p (node->decl))
{
+ symtab_node *fn = symtab_alias_ultimate_target (node);
+
+ /* Ensure that the alias is well formed this may not be the case
+ of user defined aliases and currently it is not always the case
+ of C++ same body aliases (that is a bug). */
+ if (TREE_TYPE (node->decl) != TREE_TYPE (fn->decl)
+ || DECL_CONTEXT (node->decl) != DECL_CONTEXT (fn->decl)
+ || (TREE_CODE (node->decl) == FUNCTION_DECL
+ && flags_from_decl_or_type (node->decl)
+ != flags_from_decl_or_type (fn->decl))
+ || DECL_ATTRIBUTES (node->decl) != DECL_ATTRIBUTES (fn->decl))
+ return false;
+
*(symtab_node **)data = node;
return true;
}