Commit 04e74e02 by Jakub Jelinek Committed by Jakub Jelinek

re PR fortran/23057 (Fortran common blocks are not described with DW_TAG_common_block)

	PR fortran/23057
	* dwarf2out.c (gen_variable_die): Represent Fortran COMMON vars
	as DW_TAG_variable children of DW_TAG_common_block rather than
	DW_TAG_member children.  Put DW_AT_external to individual
	DW_TAG_variable DIEs, not to DW_TAG_common_block.

	* gfortran.dg/debug/pr35154-dwarf2.f: Adjust for replacement
	of DW_TAG_member with DW_TAG_variable.

From-SVN: r139775
parent 25c29c56
2008-08-29 Jakub Jelinek <jakub@redhat.com> 2008-08-29 Jakub Jelinek <jakub@redhat.com>
PR fortran/23057
* dwarf2out.c (gen_variable_die): Represent Fortran COMMON vars
as DW_TAG_variable children of DW_TAG_common_block rather than
DW_TAG_member children. Put DW_AT_external to individual
DW_TAG_variable DIEs, not to DW_TAG_common_block.
* dwarf2out.c (add_bound_info): If lookup_decl_die failed, try * dwarf2out.c (add_bound_info): If lookup_decl_die failed, try
loc_descriptor_from_tree_1. loc_descriptor_from_tree_1.
......
...@@ -13531,43 +13531,66 @@ gen_variable_die (tree decl, dw_die_ref context_die) ...@@ -13531,43 +13531,66 @@ gen_variable_die (tree decl, dw_die_ref context_die)
{ {
tree field; tree field;
dw_die_ref com_die; dw_die_ref com_die;
dw_loc_descr_ref loc;
if (lookup_decl_die (decl)) com_die = lookup_decl_die (decl);
if (com_die)
{
if (get_AT (com_die, DW_AT_location) == NULL)
{
loc = loc_descriptor_from_tree (com_decl);
if (loc)
{
if (off)
add_loc_descr (&loc, new_loc_descr (DW_OP_plus_uconst,
off, 0));
add_AT_loc (com_die, DW_AT_location, loc);
remove_AT (com_die, DW_AT_declaration);
}
}
return; return;
}
field = TREE_OPERAND (DECL_VALUE_EXPR (decl), 0); field = TREE_OPERAND (DECL_VALUE_EXPR (decl), 0);
var_die = lookup_decl_die (com_decl); var_die = lookup_decl_die (com_decl);
loc = loc_descriptor_from_tree (com_decl);
if (var_die == NULL) if (var_die == NULL)
{ {
const char *cnam const char *cnam
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (com_decl)); = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (com_decl));
dw_loc_descr_ref loc = loc_descriptor_from_tree (com_decl);
var_die = new_die (DW_TAG_common_block, context_die, decl); var_die = new_die (DW_TAG_common_block, context_die, decl);
add_name_and_src_coords_attributes (var_die, com_decl); add_name_and_src_coords_attributes (var_die, com_decl);
add_AT_flag (var_die, DW_AT_external, 1);
if (loc) if (loc)
{
add_AT_loc (var_die, DW_AT_location, loc); add_AT_loc (var_die, DW_AT_location, loc);
/* Avoid sharing the same loc descriptor between
DW_TAG_common_block and DW_TAG_variable. */
loc = loc_descriptor_from_tree (com_decl);
}
else if (DECL_EXTERNAL (decl)) else if (DECL_EXTERNAL (decl))
add_AT_flag (var_die, DW_AT_declaration, 1); add_AT_flag (var_die, DW_AT_declaration, 1);
add_pubname_string (cnam, var_die); /* ??? needed? */ add_pubname_string (cnam, var_die); /* ??? needed? */
equate_decl_number_to_die (com_decl, var_die); equate_decl_number_to_die (com_decl, var_die);
} }
else if (get_AT (var_die, DW_AT_location) == NULL) else if (get_AT (var_die, DW_AT_location) == NULL && loc)
{
dw_loc_descr_ref loc = loc_descriptor_from_tree (com_decl);
if (loc)
{ {
add_AT_loc (var_die, DW_AT_location, loc); add_AT_loc (var_die, DW_AT_location, loc);
loc = loc_descriptor_from_tree (com_decl);
remove_AT (var_die, DW_AT_declaration); remove_AT (var_die, DW_AT_declaration);
} }
} com_die = new_die (DW_TAG_variable, var_die, decl);
com_die = new_die (DW_TAG_member, var_die, decl);
add_name_and_src_coords_attributes (com_die, decl); add_name_and_src_coords_attributes (com_die, decl);
add_type_attribute (com_die, TREE_TYPE (decl), TREE_READONLY (decl), add_type_attribute (com_die, TREE_TYPE (decl), TREE_READONLY (decl),
TREE_THIS_VOLATILE (decl), context_die); TREE_THIS_VOLATILE (decl), context_die);
add_AT_loc (com_die, DW_AT_data_member_location, add_AT_flag (com_die, DW_AT_external, 1);
int_loc_descriptor (off)); if (loc)
{
if (off)
add_loc_descr (&loc, new_loc_descr (DW_OP_plus_uconst, off, 0));
add_AT_loc (com_die, DW_AT_location, loc);
}
else if (DECL_EXTERNAL (decl))
add_AT_flag (com_die, DW_AT_declaration, 1);
equate_decl_number_to_die (decl, com_die); equate_decl_number_to_die (decl, com_die);
return; return;
} }
......
2008-08-22 Jakub Jelinek <jakub@redhat.com>
PR fortran/23057
* gfortran.dg/debug/pr35154-dwarf2.f: Adjust for replacement
of DW_TAG_member with DW_TAG_variable.
2008-08-29 Jan Hubicka <jh@suse.cz> 2008-08-29 Jan Hubicka <jh@suse.cz>
* gcc.dg/ipa/modif-1.c: Update template. * gcc.dg/ipa/modif-1.c: Update template.
......
...@@ -27,11 +27,11 @@ C { dg-options "-dA" } ...@@ -27,11 +27,11 @@ C { dg-options "-dA" }
C { dg-final { scan-assembler "(DIE.*DW_TAG_common_block)" } } C { dg-final { scan-assembler "(DIE.*DW_TAG_common_block)" } }
C { dg-final { scan-assembler "DW_AT_name: \"__BLNK__\"" } } C { dg-final { scan-assembler "DW_AT_name: \"__BLNK__\"" } }
C { dg-final { scan-assembler "(DIE.*DW_TAG_member)" } } C { dg-final { scan-assembler "(DIE.*DW_TAG_variable)" } }
C { dg-final { scan-assembler "\"i.*\".*DW_AT_name" } } C { dg-final { scan-assembler "\"i.*\".*DW_AT_name" } }
C { dg-final { scan-assembler "\"j.*\".*DW_AT_name" } } C { dg-final { scan-assembler "\"j.*\".*DW_AT_name" } }
C { dg-final { scan-assembler "(DIE.*DW_TAG_common_block)" } } C { dg-final { scan-assembler "(DIE.*DW_TAG_common_block)" } }
C { dg-final { scan-assembler "DW_AT_name: \"label\"" } } C { dg-final { scan-assembler "DW_AT_name: \"label\"" } }
C { dg-final { scan-assembler "(DIE.*DW_TAG_member)" } } C { dg-final { scan-assembler "(DIE.*DW_TAG_variable)" } }
C { dg-final { scan-assembler "\"l.*\".*DW_AT_name" } } C { dg-final { scan-assembler "\"l.*\".*DW_AT_name" } }
C { dg-final { scan-assembler "\"m.*\".*DW_AT_name" } } C { dg-final { scan-assembler "\"m.*\".*DW_AT_name" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment