This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] DWARF: Call set_indirect_string on DW_MACINFO_start_file


On Thu, Aug 23, 2018 at 5:56 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Wed, Aug 22, 2018 at 9:36 PM H.J. Lu <hongjiu.lu@intel.com> wrote:
>>
>> Since -gsplit-dwarf -g3 will output filename as indirect string, call
>> set_indirect_string on DW_MACINFO_start_file for -gsplit-dwarf -g3.
>>
>> OK for trunk?
>
> Can you add a testcase?
>
>

Here is the updated patch with a testcase.  Before my fix:

/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -m32
-O2 -fno-var-tracking-assignments -gsplit-dwarf -g3 -march=skylake
-mrtm -mabm -S x.c
x.c:14:1: internal compiler error: in output_index_string, at dwarf2out.c:28780
14 | }
   | ^
0xb090e7 output_index_string(indirect_string_node**, unsigned int*)
/export/gnu/import/git/sources/gcc/gcc/dwarf2out.c:28780
0xb09370 output_indirect_strings
/export/gnu/import/git/sources/gcc/gcc/dwarf2out.c:28868
0xb0ed85 dwarf2out_finish
/export/gnu/import/git/sources/gcc/gcc/dwarf2out.c:31563
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

After:

/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -m32
-O2 -fno-var-tracking-assignments -gsplit-dwarf -g3 -march=skylake
-mrtm -mabm -S x.c

OK for trunk?

Thanks.

-- 
H.J.
From 65c84b66ff7027a90f2108053427a516575ba78b Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 22 Aug 2018 12:25:17 -0700
Subject: [PATCH] DWARF: Call set_indirect_string on DW_MACINFO_start_file

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.
---
 gcc/dwarf2out.c                |  6 ++++++
 gcc/testsuite/gcc.dg/pr79342.c | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/pr79342.c

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 91af4e8fc4e..77317ed2575 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -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));
diff --git a/gcc/testsuite/gcc.dg/pr79342.c b/gcc/testsuite/gcc.dg/pr79342.c
new file mode 100644
index 00000000000..958de55d09b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr79342.c
@@ -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();
+}
-- 
2.17.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]