aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-10-31 20:35:47 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-10-31 20:35:47 +0100
commit5cea3ad6b50bc3bc014b3ce26774e99789c14a2f (patch)
tree134de51157bc15c220fdc4879ad108808f6989f1 /gcc/fortran
parent2a3d56bfc4890f0b5e8107883ba3436a8e6fb6a8 (diff)
downloadgcc-5cea3ad6b50bc3bc014b3ce26774e99789c14a2f.zip
gcc-5cea3ad6b50bc3bc014b3ce26774e99789c14a2f.tar.gz
gcc-5cea3ad6b50bc3bc014b3ce26774e99789c14a2f.tar.bz2
dwarf2out.h (struct dw_loc_descr_node): Adjust comment for frame_offset_rel bit.
* dwarf2out.h (struct dw_loc_descr_node): Adjust comment for frame_offset_rel bit. (struct array_descr_info): Add rank field. * dwarf2out.c (struct loc_descr_context): Add placeholder_arg and placeholder_seen fields. (resolve_args_picking_1): Handle also frame_offset_rel DW_OP_dup and DW_OP_over. Optimize DW_OP_pick 0 into DW_OP_dup and DW_OP_pick 1 into DW_OP_over. (function_to_dwarf_procedure, type_byte_size, field_byte_offset, gen_variant_part): Clear placeholder_{arg,seen}. (loc_list_from_tree_1): Drop const from context argument. Handle integral PLACEHOLDER_EXPR if context->placeholder_arg. (loc_list_for_address_of_addr_expr_of_indirect_ref, loc_list_from_tree, loc_descriptor_from_tree): Drop const from context argument. (add_scalar_info): Drop const from context argument. Handle context->placeholder_arg. (add_bound_info): Drop const from context argument. (gen_descr_array_type_die): Drop const from ctx variable. Initialize placeholder_arg and placeholder_seen. Add DW_AT_rank attribute and use a single DW_TAG_generic_subrange instead of 7 DW_TAG_subrange_type for assumed rank arrays. fortran/ * trans-types.c (gfc_get_array_descr_info): For -gdwarf-5 or -gno-strict-dwarf, handle assumed rank arrays the way dwarf2out expects. ada/ * gcc-interface/misc.c (gnat_get_array_descr_info): Clear rank field. From-SVN: r241719
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-types.c24
2 files changed, 28 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index be4f1b8..f593ab7 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2016-10-31 Jakub Jelinek <jakub@redhat.com>
+
+ * trans-types.c (gfc_get_array_descr_info): For -gdwarf-5 or
+ -gno-strict-dwarf, handle assumed rank arrays the way dwarf2out
+ expects.
+
2016-10-30 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/67219
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index eda0351..6f9bc38 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -3139,7 +3139,7 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
int rank, dim;
bool indirect = false;
tree etype, ptype, field, t, base_decl;
- tree data_off, dim_off, dim_size, elem_size;
+ tree data_off, dim_off, dtype_off, dim_size, elem_size;
tree lower_suboff, upper_suboff, stride_suboff;
if (! GFC_DESCRIPTOR_TYPE_P (type))
@@ -3203,6 +3203,7 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
data_off = byte_position (field);
field = DECL_CHAIN (field);
field = DECL_CHAIN (field);
+ dtype_off = byte_position (field);
field = DECL_CHAIN (field);
dim_off = byte_position (field);
dim_size = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (field)));
@@ -3225,6 +3226,24 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
|| GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_POINTER_CONT)
info->associated = build2 (NE_EXPR, boolean_type_node,
info->data_location, null_pointer_node);
+ if ((GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_RANK
+ || GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ASSUMED_RANK_CONT)
+ && dwarf_version >= 5)
+ {
+ rank = 1;
+ info->ndimensions = 1;
+ t = base_decl;
+ if (!integer_zerop (dtype_off))
+ t = fold_build_pointer_plus (t, dtype_off);
+ t = build1 (NOP_EXPR, build_pointer_type (gfc_array_index_type), t);
+ t = build1 (INDIRECT_REF, gfc_array_index_type, t);
+ info->rank = build2 (BIT_AND_EXPR, gfc_array_index_type, t,
+ build_int_cst (gfc_array_index_type,
+ GFC_DTYPE_RANK_MASK));
+ t = build0 (PLACEHOLDER_EXPR, TREE_TYPE (dim_off));
+ t = size_binop (MULT_EXPR, t, dim_size);
+ dim_off = build2 (PLUS_EXPR, TREE_TYPE (dim_off), t, dim_off);
+ }
for (dim = 0; dim < rank; dim++)
{
@@ -3260,7 +3279,8 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
t = build1 (INDIRECT_REF, gfc_array_index_type, t);
t = build2 (MULT_EXPR, gfc_array_index_type, t, elem_size);
info->dimen[dim].stride = t;
- dim_off = size_binop (PLUS_EXPR, dim_off, dim_size);
+ if (dim + 1 < rank)
+ dim_off = size_binop (PLUS_EXPR, dim_off, dim_size);
}
return true;