Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2018-01-08  Richard Biener  <rguent...@suse.de>

        PR lto/83719
        * dwarf2out.c (output_indirect_strings): Handle empty
        skeleton_debug_str_hash.
        (dwarf2out_early_finish): Index strings for -gsplit-dwarf.

        * gcc.dg/lto/pr83719_0.c: New testcase.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c     (revision 256329)
+++ gcc/dwarf2out.c     (working copy)
@@ -27795,8 +27795,9 @@ output_indirect_strings (void)
       unsigned int offset = 0;
       unsigned int cur_idx = 0;
 
-      skeleton_debug_str_hash->traverse<enum dwarf_form,
-                                       output_indirect_string> (DW_FORM_strp);
+      if (skeleton_debug_str_hash)
+        skeleton_debug_str_hash->traverse<enum dwarf_form,
+                                         output_indirect_string> 
(DW_FORM_strp);
 
       switch_to_section (debug_str_offsets_section);
       debug_str_hash->traverse_noresize
@@ -30819,6 +30820,12 @@ dwarf2out_early_finish (const char *file
 
   save_macinfo_strings ();
 
+  if (dwarf_split_debug_info)
+    {
+      unsigned int index = 0;
+      debug_str_hash->traverse_noresize<unsigned int *, index_string> (&index);
+    }
+
   /* Output all of the compilation units.  We put the main one last so that
      the offsets are available to output_pubnames.  */
   for (limbo_die_node *node = limbo_die_list; node; node = node->next)
Index: gcc/testsuite/gcc.dg/lto/pr83719_0.c
===================================================================
--- gcc/testsuite/gcc.dg/lto/pr83719_0.c        (nonexistent)
+++ gcc/testsuite/gcc.dg/lto/pr83719_0.c        (working copy)
@@ -0,0 +1,4 @@
+/* { dg-lto-do assemble } */
+/* { dg-lto-options { { -flto -g -gsplit-dwarf } } } */
+
+/* Empty.  */

Reply via email to