[lto][patch] Fix linking error
Rafael Espindola
espindola@google.com
Wed Mar 11 18:58:00 GMT 2009
The attached patch fixes the include testcase. The problem was that
cc1plus was writing function decls to disk that were only reachable
via the DECL_INITIAL of a vtable. It was doing so even if the vtable
had a home in another file and the vtable VAR_DECL was DECL_EXTERNAL.
Since the function decl was not really used, there was no cgraph node
for it.
In wpa we assume that if a decl has a node, then the prevailing decl
also has. This was false if the file described above (with a decl but
no cgraph node for it) was linked with a file that actually used the
function and therefore had both a function decl and a node.
One option would be to make wpa handle that case, but it is much
easier to just ovoid writing decls that are not used.
Bootstrapped and regression tested.
2009-03-11 Rafael Avila de Espindola <espindola@google.com>
* g++.dg/lto/20090311_0.C: New.
* g++.dg/lto/20090311_1.C: New.
2009-03-11 Rafael Avila de Espindola <espindola@google.com>
* tree.c (free_lang_data_in_decl): Free DECL_INITIAL of DECL_EXTERNAL
VAR_DECLs.
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix.patch
Type: text/x-diff
Size: 1161 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090311/d876cbd9/attachment.bin>
More information about the Gcc-patches
mailing list