DWARF: Call set_indirect_string on DW_MACINFO_start_file
authorH.J. Lu <hongjiu.lu@intel.com>
Fri, 24 Aug 2018 11:28:40 +0000 (11:28 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Fri, 24 Aug 2018 11:28:40 +0000 (04:28 -0700)
Since -gsplit-dwarf -g3 will output filename as indirect string, call
set_indirect_string on DW_MACINFO_start_file for -gsplit-dwarf -g3.

gcc/

PR debug/79342
* dwarf2out.c (save_macinfo_strings): Call set_indirect_string
on DW_MACINFO_start_file for -gsplit-dwarf -g3.

gcc/testsuite/

PR debug/79342
* gcc.dg/pr79342.: New test.

From-SVN: r263831

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr79342.c [new file with mode: 0644]

index e95f409da7e8a06892b8501dad0486193615413d..72f45754390484853ceb053f478a3c73d711ff2b 100644 (file)
@@ -1,3 +1,9 @@
+2018-08-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR debug/79342
+       * dwarf2out.c (save_macinfo_strings): Call set_indirect_string
+       on DW_MACINFO_start_file for -gsplit-dwarf -g3.
+
 2018-08-24  Richard Biener  <rguenther@suse.de>
 
        * cfg.h (struct control_flow_graph): Add edge_flags_allocated and
index 91af4e8fc4e0fffd28346c08ed80b2d26c3ee217..77317ed2575ad32205631f1438c2ad74b703068b 100644 (file)
@@ -28287,6 +28287,12 @@ save_macinfo_strings (void)
                 && (debug_str_section->common.flags & SECTION_MERGE) != 0)
               set_indirect_string (find_AT_string (ref->info));
             break;
+         case DW_MACINFO_start_file:
+           /* -gsplit-dwarf -g3 will also output filename as indirect
+              string.  */
+           if (!dwarf_split_debug_info)
+             break;
+           /* Fall through. */
          case DW_MACRO_define_strp:
          case DW_MACRO_undef_strp:
             set_indirect_string (find_AT_string (ref->info));
index e83279f7f9b0ead0f880bf0ef5503db0751c42dd..813676b7c5ffa2969bcd211bc39c5f89f883fbbc 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR debug/79342
+       * gcc.dg/pr79342.: New test.
+
 2018-08-23  Martin Sebor  <msebor@redhat.com>
 
        PR tree-optimization/87072
diff --git a/gcc/testsuite/gcc.dg/pr79342.c b/gcc/testsuite/gcc.dg/pr79342.c
new file mode 100644 (file)
index 0000000..958de55
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -gsplit-dwarf -g3" } */
+/* { dg-additional-options "-march=skylake -mrtm -mabm" { target x86_64-*-* i?86-*-* } } */
+
+int a;
+void b(void);
+
+void e(int *);
+int f(void);
+
+void 
+c(void)
+{
+  int d;
+  e(&d);
+  if (f())
+    b();
+}