aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/simplify.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2015-01-18 22:01:29 +0000
committerPaul Thomas <pault@gcc.gnu.org>2015-01-18 22:01:29 +0000
commit5b384b3d55927e813a97f4cd7aaef89df59ab1d8 (patch)
tree8897cf52c9332ef304732836b3ee4b66ef2cbb2c /gcc/fortran/simplify.c
parent69fe4502488fea1573f2d5166235540e3d9a466e (diff)
downloadgcc-5b384b3d55927e813a97f4cd7aaef89df59ab1d8.zip
gcc-5b384b3d55927e813a97f4cd7aaef89df59ab1d8.tar.gz
gcc-5b384b3d55927e813a97f4cd7aaef89df59ab1d8.tar.bz2
[multiple changes]
2015-01-18 Andre Vehreschild <vehre@gmx.de> Janus Weil <janus@gcc.gnu.org> PR fortran/60255 * class.c (gfc_get_len_component): New. (gfc_build_class_symbol): Add _len component to unlimited polymorphic entities. (find_intrinsic_vtab): Removed emitting of error message. * gfortran.h: Added prototype for gfc_get_len_component. * simplify.c (gfc_simplify_len): Use _len component where available. * trans-expr.c (gfc_class_len_get): New. (gfc_conv_intrinsic_to_class): Add handling for deferred character arrays. (gfc_conv_structure): Treat _len component correctly. (gfc_conv_expr): Prevent bind_c handling when not required. (gfc_trans_pointer_assignment): Propagate _len component. * trans-stmt.c (class_has_len_component): New. (trans_associate_var): _len component treatment for associate context. (gfc_trans_allocate): Same as for trans_associate_var() * trans.h: Added prototype for gfc_class_len_get. 2015-01-18 Andre Vehreschild <vehre@gmx.de> PR fortran/60255 * gfortran.dg/unlimited_polymorphic_2.f03: Removed error. * gfortran.dg/unlimited_polymorphic_20.f03: New test. 2015-01-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/64578 * gfortran.dg/unlimited_polymorphic_21.f90: New test From-SVN: r219827
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r--gcc/fortran/simplify.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 0a29fd0..92b3076 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -3713,6 +3713,14 @@ gfc_simplify_len (gfc_expr *e, gfc_expr *kind)
mpz_set (result->value.integer, e->ts.u.cl->length->value.integer);
return range_check (result, "LEN");
}
+ else if (e->expr_type == EXPR_VARIABLE && e->ts.type == BT_CHARACTER
+ && e->symtree->n.sym
+ && e->symtree->n.sym->assoc && e->symtree->n.sym->assoc->target
+ && e->symtree->n.sym->assoc->target->ts.type == BT_DERIVED)
+ /* The expression in assoc->target points to a ref to the _data component
+ of the unlimited polymorphic entity. To get the _len component the last
+ _data ref needs to be stripped and a ref to the _len component added. */
+ return gfc_get_len_component (e->symtree->n.sym->assoc->target);
else
return NULL;
}