This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix lto-symtab alias merging issue
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org, rguenther at suse dot de
- Date: Tue, 4 May 2010 19:01:43 +0200
- Subject: Fix lto-symtab alias merging issue
Hi,
for streaming all referenced varpool nodes and for c++.dg/lto/20090126-1
testcase we need the following fix to lto-symtab.c.
The problem here is that 20090126-1 links together two units, each compiled with
different ABIs. One unit use variable that is an alias of variable defined in
the other unit. lto_symtab_resolve_can_prevail_p will not return true on the
alias resulting in the logic for merging external declaration replacing alias
by external declaration.
Previously we got around without this problem because we did not stream varpool
node for the first unit and the logic handling external declarations then chose
variant with varpool node in it.
Bootstrapped/regtested x86_64-linux, also tested with the varpool encoder
patch on DLV/GCC/xalanbmk -fwhopr build. OK?
Honza
* lto-symtab.c (lto_symtab_resolve_can_prevail_p): Alias of variable
with body can prvail.
Index: lto-symtab.c
===================================================================
--- lto-symtab.c (revision 159031)
+++ lto-symtab.c (working copy)
@@ -416,7 +416,13 @@ lto_symtab_resolve_can_prevail_p (lto_sy
/* A variable should have a size. */
else if (TREE_CODE (e->decl) == VAR_DECL)
- return (e->vnode && e->vnode->finalized);
+ {
+ if (!e->vnode)
+ return false;
+ if (e->vnode->finalized)
+ return true;
+ return e->vnode->alias && e->vnode->extra_name->finalized;
+ }
gcc_unreachable ();
}