This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto] fix assertion failures in force_block_die
- From: Nathan Froyd <froydnj at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: zadeck at naturalbridge dot com
- Date: Fri, 2 Nov 2007 10:58:08 -0700
- Subject: [lto] fix assertion failures in force_block_die
The patch below fixes force_block_die to work as advertised. This fixes
a few gcc/*.c files that were failing when BLOCK DIEs were being forced.
Committed to the LTO branch.
-Nathan
2007-11-02 Nathan Froyd <froydnj@codesourcery.com>
* dwarf2out.c (force_block_die): Implement.
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 129836)
+++ dwarf2out.c (working copy)
@@ -13476,7 +13476,22 @@ force_die_for_context (tree context)
static dw_die_ref
force_block_die (tree block)
{
- gcc_unreachable ();
+ tree context = block;
+
+ /* FIXME: at some point, we should really look into using
+ tree.c:decl_function_context in this function's callers to do this
+ work, since it handles C++ bits for us as well. */
+ while (context && TREE_CODE (context) != FUNCTION_DECL)
+ {
+ if (TREE_CODE (context) == BLOCK)
+ context = BLOCK_SUPERCONTEXT (context);
+ else
+ context = get_containing_scope (context);
+ }
+
+ gcc_assert (context);
+
+ return force_decl_die (context);
}
/* Returns the DIE for decl. A DIE will always be returned. */