+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.
+
2016-09-25 Oleg Endo <olegendo@gcc.gnu.org>
PR target/51244
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;