https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98765
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- --- gcc/dwarf2out.c.jj 2021-01-20 08:32:09.612958930 +0100 +++ gcc/dwarf2out.c 2021-01-20 14:15:14.735459774 +0100 @@ -4733,12 +4733,20 @@ int reset_indirect_string (indirect_string_node **h, void *) { struct indirect_string_node *node = *h; - if (node->form == DW_FORM_strp || node->form == dwarf_FORM (DW_FORM_strx)) + if (node->form == DW_FORM_strp + || node->form == DW_FORM_line_strp + || node->form == dwarf_FORM (DW_FORM_strx)) { + bool line_strp = node->form == DW_FORM_line_strp; free (node->label); node->label = NULL; node->form = (dwarf_form) 0; node->index = 0; + if (line_strp) + { + set_indirect_string (node); + node->form = DW_FORM_line_strp; + } } return 1; } @@ -31395,10 +31403,7 @@ dwarf2out_finish (const char *filename) /* Remove indirect string decisions. */ debug_str_hash->traverse<void *, reset_indirect_string> (NULL); if (debug_line_str_hash) - { - debug_line_str_hash->traverse<void *, reset_indirect_string> (NULL); - debug_line_str_hash = NULL; - } + debug_line_str_hash->traverse<void *, reset_indirect_string> (NULL); } #if ENABLE_ASSERT_CHECKING emits them in .debug_line_str, but emits also strings that aren't really needed.