From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26207 invoked by alias); 29 Nov 2012 19:09:48 -0000 Received: (qmail 25356 invoked by uid 48); 29 Nov 2012 19:08:29 -0000 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/55466] [4.8 Regression] Revision 191466 destroyed DWARF debug info Date: Thu, 29 Nov 2012 19:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-11/txt/msg02906.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55466 --- Comment #7 from H.J. Lu 2012-11-29 19:08:28 UTC --- This patch: diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index 0b0cdac..295fd37 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -443,10 +443,6 @@ lto_symtab_merge_decls_1 (symtab_node first) symtab_prevail_in_asm_name_hash (prevailing); - /* Record the prevailing variable. */ - if (TREE_CODE (prevailing->symbol.decl) == VAR_DECL) - vec_safe_push (lto_global_var_decls, prevailing->symbol.decl); - /* Diagnose mismatched objects. */ for (e = prevailing->symbol.next_sharing_asm_name; e; e = e->symbol.next_sharing_asm_name) diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 376af85..177fbfc 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -2910,6 +2910,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) struct cgraph_node *node; int count = 0; struct lto_file_decl_data **decl_data; + struct varpool_node *vnode; init_cgraph (); @@ -3088,6 +3089,10 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) timevar_pop (TV_IPA_LTO_CGRAPH_MERGE); + /* Record the global variables. */ + FOR_EACH_DEFINED_VARIABLE (vnode) + vec_safe_push (lto_global_var_decls, vnode->symbol.decl); + timevar_push (TV_IPA_LTO_DECL_INIT_IO); /* Indicate that the cgraph is built and ready. */ or diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index 0b0cdac..295fd37 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -443,10 +443,6 @@ lto_symtab_merge_decls_1 (symtab_node first) symtab_prevail_in_asm_name_hash (prevailing); - /* Record the prevailing variable. */ - if (TREE_CODE (prevailing->symbol.decl) == VAR_DECL) - vec_safe_push (lto_global_var_decls, prevailing->symbol.decl); - /* Diagnose mismatched objects. */ for (e = prevailing->symbol.next_sharing_asm_name; e; e = e->symbol.next_sharing_asm_name) diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 376af85..c7e1100 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -3373,6 +3373,8 @@ lto_main (void) if (!seen_error ()) { + struct varpool_node *vnode; + /* If WPA is enabled analyze the whole call graph and create an optimization plan. Otherwise, read in all the function bodies and continue with optimization. */ @@ -3398,6 +3400,10 @@ lto_main (void) if (flag_lto_report) print_lto_report_1 (); } + + /* Record the global variables. */ + FOR_EACH_DEFINED_VARIABLE (vnode) + vec_safe_push (lto_global_var_decls, vnode->symbol.decl); } /* Here we make LTO pretend to be a parser. */ seem to work.