gcc/gcc43-fortran-debug11.patch

74 lines
2.9 KiB
Diff

2008-08-28 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (descr_info_loc): Handle VAR_DECL.
* trans.h (struct lang_type): Add span.
(GFC_TYPE_ARRAY_SPAN): Define.
* trans-decl.c (gfc_get_symbol_decl): For subref array pointers,
copy TREE_STATIC from decl to span instead of setting it
unconditionally, set DECL_ARTIFICIAL, fix type of initializer
and set GFC_TYPE_ARRAY_SPAN on decl's type.
* trans-types.c (gfc_get_array_descr_info): If
GFC_TYPE_ARRAY_SPAN is non-NULL, use it as element size.
--- gcc/fortran/trans.h.jj 2008-08-26 21:43:04.000000000 +0200
+++ gcc/fortran/trans.h 2008-08-28 09:58:01.000000000 +0200
@@ -605,6 +605,7 @@ struct lang_type GTY(())
tree offset;
tree dtype;
tree dataptr_type;
+ tree span;
};
struct lang_decl GTY(())
@@ -657,6 +658,7 @@ struct lang_decl GTY(())
#define GFC_TYPE_ARRAY_DTYPE(node) (TYPE_LANG_SPECIFIC(node)->dtype)
#define GFC_TYPE_ARRAY_DATAPTR_TYPE(node) \
(TYPE_LANG_SPECIFIC(node)->dataptr_type)
+#define GFC_TYPE_ARRAY_SPAN(node) (TYPE_LANG_SPECIFIC(node)->span)
/* Build an expression with void type. */
#define build1_v(code, arg) build1(code, void_type_node, arg)
--- gcc/fortran/trans-decl.c.jj 2008-08-26 22:54:24.000000000 +0200
+++ gcc/fortran/trans-decl.c 2008-08-28 10:54:28.000000000 +0200
@@ -1105,10 +1105,12 @@ gfc_get_symbol_decl (gfc_symbol * sym)
span = build_decl (VAR_DECL, create_tmp_var_name ("span"),
gfc_array_index_type);
gfc_finish_var_decl (span, sym);
- TREE_STATIC (span) = 1;
- DECL_INITIAL (span) = build_int_cst (NULL_TREE, 0);
+ TREE_STATIC (span) = TREE_STATIC (decl);
+ DECL_ARTIFICIAL (span) = 1;
+ DECL_INITIAL (span) = build_int_cst (gfc_array_index_type, 0);
GFC_DECL_SPAN (decl) = span;
+ GFC_TYPE_ARRAY_SPAN (TREE_TYPE (decl)) = span;
}
sym->backend_decl = decl;
--- gcc/fortran/trans-types.c.jj 2008-08-26 21:43:04.000000000 +0200
+++ gcc/fortran/trans-types.c 2008-08-28 10:23:39.000000000 +0200
@@ -2289,7 +2289,10 @@ gfc_get_array_descr_info (const_tree typ
else
info->base_decl = base_decl = build_decl (VAR_DECL, NULL_TREE, ptype);
- elem_size = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (etype));
+ if (GFC_TYPE_ARRAY_SPAN (type))
+ elem_size = GFC_TYPE_ARRAY_SPAN (type);
+ else
+ elem_size = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (etype));
field = TYPE_FIELDS (TYPE_MAIN_VARIANT (type));
data_off = byte_position (field);
field = TREE_CHAIN (field);
--- gcc/dwarf2out.c.jj 2008-08-26 21:43:42.000000000 +0200
+++ gcc/dwarf2out.c 2008-08-28 10:35:38.000000000 +0200
@@ -12232,6 +12232,8 @@ descr_info_loc (tree val, tree base_decl
case NOP_EXPR:
case CONVERT_EXPR:
return descr_info_loc (TREE_OPERAND (val, 0), base_decl);
+ case VAR_DECL:
+ return loc_descriptor_from_tree_1 (val, 0);
case INTEGER_CST:
if (host_integerp (val, 0))
return int_loc_descriptor (tree_low_cst (val, 0));