* [lto] fix debug information for global initialized variables
@ 2007-11-09 14:42 Nathan Froyd
0 siblings, 0 replies; only message in thread
From: Nathan Froyd @ 2007-11-09 14:42 UTC (permalink / raw)
To: gcc-patches; +Cc: zadeck
When the LTO reader read in DIEs for global variables, it expected that
DW_AT_declaration would be unset if an initializer of some sort needed
to be read in as well. However, due to the way force_decl_die works, we
would always set DW_AT_declaration on global variables. The result was
that the LTO reader wouldn't read in initializers and we would wind up
failing testcases like 20000227-1.c because the generated assembly would
contain references to 'f' and 'g'.
Fixed with the following patch. Applied to the LTO branch.
-Nathan
2007-11-09 Nathan Froyd <froydnj@codesourcery.com>
* dwarf2out.c (lto_var_ref): Remove DW_AT_declaration if we are
forcing an initialized global variable.
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c (revision 129966)
+++ gcc/dwarf2out.c (working copy)
@@ -15137,6 +15137,11 @@ lto_var_ref (tree var,
gcc_assert (TREE_CODE (var) == VAR_DECL);
/* Generate the DIE for VAR. */
die = force_decl_die (var);
+ /* If we are forcing an initialized global variable, then remove
+ DW_AT_declaration so the LTO reader understands that we need to
+ read in its initializer. */
+ if (DECL_CONTEXT (var) == NULL_TREE && DECL_INITIAL (var))
+ remove_AT (die, DW_AT_declaration);
/* Construct the reference. */
lto_init_ref (ref, die, DECL_CONTEXT (var));
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-11-09 14:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-09 14:42 [lto] fix debug information for global initialized variables Nathan Froyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).