2016-02-25 Jakub Jelinek PR debug/69947 * dwarf2out.c (prune_unused_types_walk): Don't prune DW_TAG_dwarf_procedure. * gcc.dg/guality/pr69947.c: New test. --- gcc/dwarf2out.c.jj 2016-02-24 23:03:32.000000000 +0100 +++ gcc/dwarf2out.c 2016-02-25 10:08:46.688716691 +0100 @@ -25853,11 +25853,6 @@ prune_unused_types_walk (dw_die_ref die) case DW_TAG_file_type: /* Type nodes are useful only when other DIEs reference them --- don't mark them. */ - /* FALLTHROUGH */ - - case DW_TAG_dwarf_procedure: - /* Likewise for DWARF procedures. */ - if (die->die_perennial_p) break; --- gcc/testsuite/gcc.dg/guality/pr69947.c.jj 2016-02-25 10:00:25.503608176 +0100 +++ gcc/testsuite/gcc.dg/guality/pr69947.c 2016-02-25 10:05:20.446552599 +0100 @@ -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; +}