2016-02-25 Jakub Jelinek PR debug/69947 * dwarf2out.c (string_cst_pool_decl): Set die_perennial_p on the DW_TAG_dwarf_procedure DIE. * 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 @@ -26288,6 +26288,7 @@ string_cst_pool_decl (tree t) l->dw_loc_oprnd2.v.val_vec.elt_size = 1; l->dw_loc_oprnd2.v.val_vec.array = array; add_AT_loc (ref, DW_AT_location, l); + ref->die_perennial_p = 1; equate_decl_number_to_die (decl, ref); } return rtl; --- 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; +}