http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46123
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-18 13:13:57 UTC --- Created attachment 22446 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22446 gcc46-pr46123.patch Ugh, this is very ugly. gen_subprogram_die sometimes decides to reuse old_die which was DW_AT_declaration and can be deeply nested in type children, which breaks -feliminate-dwarf2-dups as well as -gdwarf-4 if those are moved to separate CUs (either the comdat ones or .debug_types). The patch fixes this by not reusing the old die if doing one or another way of duplicate removals (perhaps could do an extra check if the old_die is actually in a tree that is going to be moved, which wouldn't be that hard to do for break_out_includes, but would be uglier for .debug_types). Or we could do it always. Unfortunately just doing that leads to crashes, because context_die is NULL and dwarf2out_finish doesn't want to see limbo DIEs with type contexts, so the patch also uses comp_unit_die () in that case. Jason/Cary, what do you think?