]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR debug/69947 (DW_OP_GNU_implicit_pointer broken on the trunk)
authorJakub Jelinek <jakub@redhat.com>
Fri, 4 Mar 2016 07:27:15 +0000 (08:27 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 4 Mar 2016 07:27:15 +0000 (08:27 +0100)
PR debug/69947
* dwarf2out.c (prune_unused_types_walk_loc_descr): Handle
all other ops that have dw_val_class_die_ref operands,
and DW_OP_GNU_entry_value.

* gcc.dg/guality/pr69947.c: New test.

From-SVN: r233958

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

index 9ae55001ca9917116abceb9f43bb02658442d293..6f7e896e708c787d47680fcb939b5e9fd8f4b876 100644 (file)
@@ -1,3 +1,10 @@
+2016-03-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/69947
+       * dwarf2out.c (prune_unused_types_walk_loc_descr): Handle
+       all other ops that have dw_val_class_die_ref operands,
+       and DW_OP_GNU_entry_value.
+
 2016-03-03  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR rtl-optimization/69904
index a8c21d809ce5a6779656b55390cde8b676c196d9..6d5e3f540f5a05d02b203524ba402e54e1df9366 100644 (file)
@@ -25641,11 +25641,29 @@ prune_unused_types_walk_loc_descr (dw_loc_descr_ref loc)
   for (; loc != NULL; loc = loc->dw_loc_next)
     switch (loc->dw_loc_opc)
       {
+      case DW_OP_GNU_implicit_pointer:
+      case DW_OP_GNU_convert:
+      case DW_OP_GNU_reinterpret:
+       if (loc->dw_loc_oprnd1.val_class == dw_val_class_die_ref)
+         prune_unused_types_mark (loc->dw_loc_oprnd1.v.val_die_ref.die, 1);
+       break;
       case DW_OP_call2:
       case DW_OP_call4:
       case DW_OP_call_ref:
+      case DW_OP_GNU_const_type:
+      case DW_OP_GNU_parameter_ref:
+       gcc_assert (loc->dw_loc_oprnd1.val_class == dw_val_class_die_ref);
        prune_unused_types_mark (loc->dw_loc_oprnd1.v.val_die_ref.die, 1);
        break;
+      case DW_OP_GNU_regval_type:
+      case DW_OP_GNU_deref_type:
+       gcc_assert (loc->dw_loc_oprnd2.val_class == dw_val_class_die_ref);
+       prune_unused_types_mark (loc->dw_loc_oprnd2.v.val_die_ref.die, 1);
+       break;
+      case DW_OP_GNU_entry_value:
+       gcc_assert (loc->dw_loc_oprnd1.val_class == dw_val_class_loc);
+       prune_unused_types_walk_loc_descr (loc->dw_loc_oprnd1.v.val_loc);
+       break;
       default:
        break;
       }
index ba4ca4c7741a7fc4b7aba793f6a869e7390e3f95..960d40b0b5314f473c1d3ada8ad8a4e48c661f8b 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/69947
+       * gcc.dg/guality/pr69947.c: New test.
+
 2016-03-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR ada/70017
diff --git a/gcc/testsuite/gcc.dg/guality/pr69947.c b/gcc/testsuite/gcc.dg/guality/pr69947.c
new file mode 100644 (file)
index 0000000..6280ed5
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR debug/69947 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+#include "../nop.h"
+
+static const char *c = "foobar";
+
+__attribute__((noinline, noclone)) void
+foo (void)
+{
+  static const char a[] = "abcdefg";
+  const char *b = a;           /* { dg-final { gdb-test 14 "c\[2\]" "'o'" } } */
+  asm (NOP : : : "memory");    /* { dg-final { gdb-test 14 "b\[4\]" "'e'" } } */
+}
+
+int
+main ()
+{
+  foo ();
+  return 0;
+}