------- Comment #1 from hjl dot tools at gmail dot com 2008-06-21 15:49 ------- varpool_output_debug_info has
/* Local static variables are never seen by check_global_declarations so we need to output debug info by hand. */ if (DECL_CONTEXT (node->decl) && (TREE_CODE (DECL_CONTEXT (node->decl)) == BLOCK || TREE_CODE (DECL_CONTEXT (node->decl)) == FUNCTION_DECL) && errorcount == 0 && sorrycount == 0) (*debug_hooks->global_decl) (node->decl); This is no longer called with -O0. Should cgraph_output_in_order handle local static variable? Index: cgraphunit.c =================================================================== --- cgraphunit.c (revision 136905) +++ cgraphunit.c (working copy) @@ -1303,7 +1303,15 @@ cgraph_output_in_order (void) break; case ORDER_VAR: - varpool_assemble_decl (nodes[i].u.v); + pv = nodes[i].u.v; + varpool_assemble_decl (pv); + /* Since check_global_declarations never sees local static + variables, we need to output debug info by hand. */ + if (DECL_CONTEXT (pv->decl) + && (TREE_CODE (DECL_CONTEXT (pv->decl)) == BLOCK + || (TREE_CODE (DECL_CONTEXT (pv->decl)) + == FUNCTION_DECL))) + (*debug_hooks->global_decl) (pv->decl); break; case ORDER_ASM: -- hjl dot tools at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[4.4 Regression]: |[4.4 Regression]: No debug |gcc.dg/debug/dwarf2/var1.c |info for local static |scan-assembler |variable at -O0 |xyzzy[^\\\\n\\\\r]+DW_AT_nam| |e | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36589