aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-09-26 07:33:33 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-09-26 07:33:33 +0000
commite6358ebda41b1adabd1037824c03c334d6395ccf (patch)
treed4a9ade717262e003ea2e5026d262f5d369d38a9 /gcc/cgraphunit.c
parentec0dba2b3ae4f555c3b0bf34fa4cf551b0f0e77d (diff)
downloadgcc-e6358ebda41b1adabd1037824c03c334d6395ccf.zip
gcc-e6358ebda41b1adabd1037824c03c334d6395ccf.tar.gz
gcc-e6358ebda41b1adabd1037824c03c334d6395ccf.tar.bz2
re PR debug/77692 (gcc.dg/debug/dwarf2/const-2b.c FAILs)
2016-09-26 Richard Biener <rguenther@suse.de> 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
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 4141bad..e38f0bf 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;