https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69947
            Bug ID: 69947
           Summary: [6 Regression] DW_OP_GNU_implicit_pointer broken on
                    the trunk
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: wrong-debug
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: jakub at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

/* PR debug/ */
/* { dg-do run } */
/* { dg-options "-g" } */

#include "../nop.h"

__attribute__((noinline, noclone)) void
foo (void)
{
  static const char a[] = "abcdefg";
  const char *b = a;
  asm (NOP : : : "memory"); /* { dg-final { gdb-test 12 "b\[4\]" "'e'" } } */
}

int
main ()
{
  foo ();
  return 0;
}

in form of guality testcase got broken by r231762 , before that change we were
emitting something like:
        .byte   0xf2    # DW_OP_GNU_implicit_pointer
        .long   .Ldebug_info0+196
        .sleb128 0
but after that we emit:
        .byte   0xf2    # DW_OP_GNU_implicit_pointer
        .long   .Ldebug_info0+0
        .sleb128 0
which is of course invalid, no DIE lives at offset 0 (and e.g. dwz complains
about this and gives up on optimizing it).  In gcc.log dump from current trunk
one can see gdb is unhappy about that too:
Breakpoint 1, foo () at /usr/src/gcc/gcc/testsuite/gcc.dg/guality/prNNNNN.c:12
12        asm (NOP : : : "memory");     /* { dg-final { gdb-test 12 "b\[4\]"
"'e'" } } */
prNNNNN.gdb:3: Error in sourced command file:
Dwarf Error: Cannot find DIE at 0x0 referenced in module
/usr/src/gcc/obj/gcc/testsuite/gcc/prNNNNN.exe
UNSUPPORTED: gcc.dg/guality/prNNNNN.c   -O1  line 12 b[4] == 'e'

Reply via email to