From: Richard Biener Date: Mon, 26 Sep 2016 07:33:33 +0000 (+0000) Subject: re PR debug/77692 (gcc.dg/debug/dwarf2/const-2b.c FAILs) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e6358ebda41b1adabd1037824c03c334d6395ccf;p=gcc.git re PR debug/77692 (gcc.dg/debug/dwarf2/const-2b.c FAILs) 2016-09-26 Richard Biener PR debug/77692 * cgraphunit.c (analyze_functions): Before early removing global vars calls the late_global_decl debug handler mark the variable as readonly. From-SVN: r240483 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce6841b6894..8d85d83fed1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-09-26 Richard Biener + + PR debug/77692 + * cgraphunit.c (analyze_functions): Before early removing + global vars calls the late_global_decl debug handler mark + the variable as readonly. + 2016-09-25 Oleg Endo PR target/51244 diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 4141badd2f5..e38f0bf4e86 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1194,8 +1194,15 @@ analyze_functions (bool first_time) at looking at optimized away DECLs, since late_global_decl will subsequently be called from the contents of the now pruned symbol table. */ - if (!decl_function_context (node->decl)) - (*debug_hooks->late_global_decl) (node->decl); + if (TREE_CODE (node->decl) == VAR_DECL + && !decl_function_context (node->decl)) + { + /* We are reclaiming totally unreachable code and variables + so they effectively appear as readonly. Show that to + the debug machinery. */ + TREE_READONLY (node->decl) = 1; + (*debug_hooks->late_global_decl) (node->decl); + } node->remove (); continue;