This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/2] DWARF: process all TYPE_DECL nodes when iterating on scopes


Hello,

In Ada, it is possible to have nested subprograms in the following
configuration:

    procedure Parent is
       type T;
       [...]
       procedure Child (Value : T) is
       begin
          [...]
       end Child;
    begin
       [...]
    end Parent;

If we generate debugging information for Child first before Parent, the
debug info for T will be generated at global scope since the DIE for
Parent does not exist yet. It is when generating debug info for Parent
that we are supposed to relocate it thanks to decls_for_scope and
process_scope_var.

However, process_scope_var currently works only on TYPE_DECL nodes that
are stubs, for unknown reasons. This change adapts it to work on all
TYPE_DECL nodes.

It bootstrapped and regtested fine on x86_64-linux and triggered to
regression in the GDB testsuite for Ada, C, C++ and Fortran. Ok to
commit? Thank you in advance!

gcc/ChangeLog:

	* dwarf2out.c (process_scope_var): Relocate TYPE_DECL nodes that
	are not stubs just like stub ones.
---
 gcc/dwarf2out.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 2c0bd63..da5524e 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -22829,8 +22829,7 @@ process_scope_var (tree stmt, tree decl, tree origin, dw_die_ref context_die)
    if (TREE_CODE (decl_or_origin) == FUNCTION_DECL)
     die = lookup_decl_die (decl_or_origin);
-  else if (TREE_CODE (decl_or_origin) == TYPE_DECL
-           && TYPE_DECL_IS_STUB (decl_or_origin))
+  else if (TREE_CODE (decl_or_origin) == TYPE_DECL)
     die = lookup_type_die (TREE_TYPE (decl_or_origin));
   else
     die = NULL;
--
2.6.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]