http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46123
--- Comment #4 from ccoutant at google dot com 2010-11-19 02:17:27 UTC --- > 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. When would context_die == NULL in a case where it would not be OK to reuse the old_die? Wouldn't it be sufficient to force the new die only if context_die != NULL? -cary