PR debug/86459 - Fix -gsplit-dwarf -g3 gcc_assert

Message ID 1531261208-32133-1-git-send-email-mark@klomp.org
State New
Headers show
Series
  • PR debug/86459 - Fix -gsplit-dwarf -g3 gcc_assert
Related show

Commit Message

Mark Wielaard July 10, 2018, 10:20 p.m.
There was a typo in the output_macinfo_op gcc_assert.
The function is called dwarf_FORM, not dwarf_form.
Add the provided testcase from the bug to test -gsplit-dwarf -g3.

gcc/ChangeLog:

	PR debug/86459
	* dwarf2out.c (output_macinfo_op): Fix dwarf_FORM typo in gcc_assert.

gcc/testsuite/ChangeLog:

	PR debug/86459
	* gcc.dg/pr86459.c: New test.
---

Comments

Jakub Jelinek July 10, 2018, 10:29 p.m. | #1
On Wed, Jul 11, 2018 at 12:20:08AM +0200, Mark Wielaard wrote:
> There was a typo in the output_macinfo_op gcc_assert.
> The function is called dwarf_FORM, not dwarf_form.
> Add the provided testcase from the bug to test -gsplit-dwarf -g3.
> 
> gcc/ChangeLog:
> 
> 	PR debug/86459
> 	* dwarf2out.c (output_macinfo_op): Fix dwarf_FORM typo in gcc_assert.
> 
> gcc/testsuite/ChangeLog:
> 
> 	PR debug/86459
> 	* gcc.dg/pr86459.c: New test.

Ok, thanks.

	Jakub

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9523217..4640a22 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -28066,7 +28066,7 @@  output_macinfo_op (macinfo_entry *ref)
       node = find_AT_string (ref->info);
       gcc_assert (node
 		  && (node->form == DW_FORM_strp
-		      || node->form == dwarf_form (DW_FORM_strx)));
+		      || node->form == dwarf_FORM (DW_FORM_strx)));
       dw2_asm_output_data (1, ref->code,
 			   ref->code == DW_MACRO_define_strp
 			   ? "Define macro strp"
diff --git a/gcc/testsuite/gcc.dg/pr86459.c b/gcc/testsuite/gcc.dg/pr86459.c
new file mode 100644
index 0000000..7856a37
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr86459.c
@@ -0,0 +1,19 @@ 
+/* { dg-do compile } */
+/* { dg-options "-g -O2 -fno-var-tracking-assignments -gsplit-dwarf -g3" } */
+
+/* Same as pr86064.c but compiled with -g3 it showed an issue in
+   output_macinfo_op because of a typo in an assert.  */
+
+int a;
+__attribute__((__cold__)) void b();
+
+void e(int *);
+int f();
+
+void c() {
+  int d;
+  e(&d);
+  a = d;
+  if (f())
+    b();
+}