This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto] fix reading subroutine DIEs
- From: Nathan Froyd <froydnj at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: zadeck at naturalbridge dot com
- Date: Mon, 29 Oct 2007 13:48:38 -0700
- Subject: [lto] fix reading subroutine DIEs
The patch below fixes a problem with reading subroutine DIEs. If the
subroutine DIE had a DW_AT_abstract_origin, we would return that
reference without reading the DIE's children. This would cause us to
read the child DIEs as toplevel DIEs, with disastrous results. The fix
is to always read the child DIEs.
Committed to the LTO branch.
-Nathan
2007-10-29 Mark Mitchell <mark@codesourcery.com>
Nathan Froyd <froydnj@codesourcery.com>
* lto.c (lto_read_subroutine_type_subprogram_DIE): Read the child
DIEs even if we find an abstract origin for this DIE.
Index: lto.c
===================================================================
--- lto.c (revision 129722)
+++ lto.c (working copy)
@@ -2541,7 +2541,11 @@ lto_read_subroutine_type_subprogram_DIE
}
if (abstract_origin)
- return abstract_origin;
+ {
+ result = abstract_origin;
+
+ goto read_children;
+ }
/* The DWARF3 specification says that a return type is only
specified for functions that return a value. Therefore,
@@ -2619,6 +2623,7 @@ lto_read_subroutine_type_subprogram_DIE
}
/* Read the child DIEs, which are in the scope of RESULT. */
+ read_children:
if (TREE_CODE (result) == FUNCTION_DECL)
{
saved_scope = context->scope;