Hi, this patch fixes thinko in cgraph_address_taken_from_non_vtable_p that valks references in NODE instead of references of NODE. It fixes the testcase in http://sourceware.org/bugzilla/show_bug.cgi?id=12942 in non-plugin LTO and Gold, but not with GNU LD that presently handle resolution info incorrectly for comdats.
Dave, do you think you could fix the GNU LD issue? Once fixed, I wonder if I should not add the testcase as lto/broken_comdat_in_gnu_ld.c or something similar like we have testcases for glibc/mpfr bugs? Bootstrapped/regtested x86_64-linux, comitted. Index: ChangeLog =================================================================== --- ChangeLog (revision 175554) +++ ChangeLog (working copy) @@ -1,3 +1,8 @@ +2011-06-27 Jan Hubicka <j...@suse.cz> + + * ipa.c (cgraph_address_taken_from_non_vtable_p): Walk references of node + instead of references in node. + 2011-06-27 Richard Henderson <r...@redhat.com> * config/alpha/alpha.c (vms_patch_builtins): Provide dummy definition. Index: ipa.c =================================================================== --- ipa.c (revision 175554) +++ ipa.c (working copy) @@ -542,13 +542,13 @@ cgraph_address_taken_from_non_vtable_p ( { int i; struct ipa_ref *ref; - for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref); i++) + for (i = 0; ipa_ref_list_refering_iterate (&node->ref_list, i, ref); i++) if (ref->use == IPA_REF_ADDR) { struct varpool_node *node; - if (ref->refered_type == IPA_REF_CGRAPH) + if (ref->refering_type == IPA_REF_CGRAPH) return true; - node = ipa_ref_varpool_node (ref); + node = ipa_ref_refering_varpool_node (ref); if (!DECL_VIRTUAL_P (node->decl)) return true; }