http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53572
Matt Hargett <matt at use dot net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matt at use dot net --- Comment #11 from Matt Hargett <matt at use dot net> 2012-09-04 23:48:40 UTC --- Applying this patch to my 4.7 branch checkout fixes my problem, which had the same symptoms. Can someone please commit this to the 4.7 branch? =================================================================== --- ../google-gcc-4_7/gcc/cgraph.h (revision 190939) +++ ../google-gcc-4_7/gcc/cgraph.h (working copy) @@ -1004,10 +1004,16 @@ static inline bool varpool_can_remove_if_no_refs (struct varpool_node *node) { - return (!node->force_output && !node->used_from_other_partition + if (DECL_EXTERNAL (node->decl)) + return true; + + return (!node->force_output && !node->used_from_other_partition && (flag_toplevel_reorder || DECL_COMDAT (node->decl) || DECL_ARTIFICIAL (node->decl)) - && (DECL_COMDAT (node->decl) || !node->externally_visible)); + && ((DECL_COMDAT (node->decl) + && !varpool_used_from_object_file_p (node)) + || !node->externally_visible + || DECL_HAS_VALUE_EXPR_P (node->decl))); }