trans-decl.c (gfc_build_qualified_array): Build non-flat array type for debug info purposes.

* trans-decl.c (gfc_build_qualified_array): Build non-flat
	array type for debug info purposes.

	* dwarf2out.c (add_bound_info): If lookup_decl_die failed, try
	loc_descriptor_from_tree_1.

From-SVN: r139774
This commit is contained in:
Jakub Jelinek 2008-08-29 20:43:57 +02:00 committed by Jakub Jelinek
parent a64f5186dd
commit 25c29c56e2
4 changed files with 56 additions and 0 deletions

View File

@ -1,5 +1,8 @@
2008-08-29 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (add_bound_info): If lookup_decl_die failed, try
loc_descriptor_from_tree_1.
PR fortran/29635
PR fortran/23057
* debug.h (struct gcc_debug_hooks): Add NAME and CHILD

View File

@ -11934,6 +11934,7 @@ add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree b
case RESULT_DECL:
{
dw_die_ref decl_die = lookup_decl_die (bound);
dw_loc_descr_ref loc;
/* ??? Can this happen, or should the variable have been bound
first? Probably it can, since I imagine that we try to create
@ -11942,6 +11943,11 @@ add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree b
later parameter. */
if (decl_die != NULL)
add_AT_die_ref (subrange_die, bound_attr, decl_die);
else
{
loc = loc_descriptor_from_tree_1 (bound, 0);
add_AT_location_description (subrange_die, bound_attr, loc);
}
break;
}

View File

@ -1,5 +1,8 @@
2008-08-29 Jakub Jelinek <jakub@redhat.com>
* trans-decl.c (gfc_build_qualified_array): Build non-flat
array type for debug info purposes.
PR fortran/29635
PR fortran/23057
* f95-lang.c (gfc_init_ts): New function.

View File

@ -703,6 +703,50 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
TYPE_DOMAIN (type) = range;
layout_type (type);
}
if (nest || write_symbols == NO_DEBUG)
return;
if (TYPE_NAME (type) != NULL_TREE
&& GFC_TYPE_ARRAY_UBOUND (type, sym->as->rank - 1) != NULL_TREE
&& TREE_CODE (GFC_TYPE_ARRAY_UBOUND (type, sym->as->rank - 1)) == VAR_DECL)
{
tree gtype = DECL_ORIGINAL_TYPE (TYPE_NAME (type));
for (dim = 0; dim < sym->as->rank - 1; dim++)
{
gcc_assert (TREE_CODE (gtype) == ARRAY_TYPE);
gtype = TREE_TYPE (gtype);
}
gcc_assert (TREE_CODE (gtype) == ARRAY_TYPE);
if (TYPE_MAX_VALUE (TYPE_DOMAIN (gtype)) == NULL)
TYPE_NAME (type) = NULL_TREE;
}
if (TYPE_NAME (type) == NULL_TREE)
{
tree gtype = TREE_TYPE (type), rtype, type_decl;
for (dim = sym->as->rank - 1; dim >= 0; dim--)
{
rtype = build_range_type (gfc_array_index_type,
GFC_TYPE_ARRAY_LBOUND (type, dim),
GFC_TYPE_ARRAY_UBOUND (type, dim));
gtype = build_array_type (gtype, rtype);
/* Ensure the bound variables aren't optimized out at -O0. */
if (!optimize)
{
if (GFC_TYPE_ARRAY_LBOUND (type, dim)
&& TREE_CODE (GFC_TYPE_ARRAY_LBOUND (type, dim)) == VAR_DECL)
DECL_IGNORED_P (GFC_TYPE_ARRAY_LBOUND (type, dim)) = 0;
if (GFC_TYPE_ARRAY_UBOUND (type, dim)
&& TREE_CODE (GFC_TYPE_ARRAY_UBOUND (type, dim)) == VAR_DECL)
DECL_IGNORED_P (GFC_TYPE_ARRAY_UBOUND (type, dim)) = 0;
}
}
TYPE_NAME (type) = type_decl = build_decl (TYPE_DECL, NULL, gtype);
DECL_ORIGINAL_TYPE (type_decl) = gtype;
}
}