From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25789 invoked by alias); 23 Apr 2008 22:34:24 -0000 Received: (qmail 25630 invoked by uid 48); 23 Apr 2008 22:33:39 -0000 Date: Wed, 23 Apr 2008 22:34:00 -0000 Message-ID: <20080423223339.25629.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug debug/27574] [4.1/4.2/4.3/4.4 Regression] MIssing debug info at -O0 for a local variable in a C++ constructor In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ian at airs dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-04/txt/msg01677.txt.bz2 ------- Comment #21 from ian at airs dot com 2008-04-23 22:33 ------- A patch like this seems like a decent workaround to me. Honza, any opinions on this approach? Ian Index: cgraph.c =================================================================== --- cgraph.c (revision 134283) +++ cgraph.c (working copy) @@ -615,6 +615,14 @@ cgraph_remove_node (struct cgraph_node * kill_body = true; } + /* We don't release the body of abstract functions, because they may + be needed when emitting debugging information. In particular + this will happen for C++ constructors/destructors. FIXME: + Ideally we would check to see whether there are any reachable + functions whose DECL_ABSTRACT_ORIGIN points to this decl. */ + if (DECL_ABSTRACT (node->decl)) + kill_body = false; + if (kill_body && flag_unit_at_a_time) cgraph_release_function_body (node); node->decl = NULL; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27574