From 6b20f353f6c35385c5e473672ed373e4470df908 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Wed, 12 Nov 2008 21:57:44 +0000 Subject: re PR debug/27574 (MIssing debug info at -O0 for a local variable in a C++ constructor) gcc/ChangeLog: 2008-11-12 Dodji Seketeli PR debug/27574 * cgraph.h: New abstract_and_needed member to struct cgraph_node. * cgraphunit.c (cgraph_analyze_functions): Flag abstract functions - which clones are reachable - as "abstract and needed". * cgraph.c (cgraph_release_function_body): If a node is "abstract and needed", do not release its DECL_INITIAL() content because that will be needed to emit debug info. gcc/testsuite/ChangeLog: 2008-11-12 Dodji Seketeli PR debug/27574 * g++.dg/debug/dwarf2/local-var-in-contructor.C: New test. From-SVN: r141807 --- gcc/cgraphunit.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/cgraphunit.c') diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 7c84573..cd58c2a 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -896,6 +896,15 @@ cgraph_analyze_functions (void) if (!edge->callee->reachable) cgraph_mark_reachable_node (edge->callee); + /* If decl is a clone of an abstract function, mark that abstract + function so that we don't release its body. The DECL_INITIAL() of that + abstract function declaration will be later needed to output debug info. */ + if (DECL_ABSTRACT_ORIGIN (decl)) + { + struct cgraph_node *origin_node = cgraph_node (DECL_ABSTRACT_ORIGIN (decl)); + origin_node->abstract_and_needed = true; + } + /* We finalize local static variables during constructing callgraph edges. Process their attributes too. */ process_function_and_variable_attributes (first_processed, -- cgit v1.1