http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50494
--- Comment #28 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2013-03-05 14:23:19 UTC --- > Hmm, but when I use the same contents for the two arrays in my simple > testcase I do get only a single .LC0 output referenced from two places. > We will end up sharing the same RTL for both (unmerged) DECLs - but > I don't see how this can be a problem? Maybe we fail to set > TREE_ASM_WRITTEN on the duplicate and output it anyway via other > mechanisms? We simply fail to set TREE_ASM_WRITTEN on the DECL_INITIAL (decl) because it is not shared anymore. So probably: Index: varasm.c =================================================================== --- varasm.c (revision 196416) +++ varasm.c (working copy) @@ -3112,7 +3112,6 @@ build_constant_desc (tree exp, tree decl LTO mode. Instead we set the flag that will be recognized in make_decl_rtl. */ DECL_IN_CONSTANT_POOL (decl) = 1; - DECL_INITIAL (decl) = desc->value; /* ??? CONSTANT_ALIGNMENT hasn't been updated for vector types on most architectures so use DATA_ALIGNMENT as well, except for strings. */ if (TREE_CODE (exp) == STRING_CST) @@ -3125,6 +3124,8 @@ build_constant_desc (tree exp, tree decl align_variable (decl, 0); } + DECL_INITIAL (decl) = desc->value; + /* Now construct the SYMBOL_REF and the MEM. */ if (use_object_blocks_p ()) {