aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/simplify.c
diff options
context:
space:
mode:
authorAndre Vehreschild <vehre@gcc.gnu.org>2016-07-14 19:07:47 +0200
committerAndre Vehreschild <vehre@gcc.gnu.org>2016-07-14 19:07:47 +0200
commit1f8dd420ebf769bd0b8068af416735f082464575 (patch)
tree7f737d9f104e3471b6e68a90dba3176927887b54 /gcc/fortran/simplify.c
parentaefae0f13c8622a095ae966de321566d529bbd70 (diff)
downloadgcc-1f8dd420ebf769bd0b8068af416735f082464575.zip
gcc-1f8dd420ebf769bd0b8068af416735f082464575.tar.gz
gcc-1f8dd420ebf769bd0b8068af416735f082464575.tar.bz2
re PR fortran/70842 (internal compiler error with character members within a polymorphic pointer)
gcc/testsuite/ChangeLog: 2016-07-14 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/70842 * gfortran.dg/select_type_35.f03: New test. gcc/fortran/ChangeLog: 2016-07-14 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/70842 * simplify.c (gfc_simplify_len): Only for unlimited polymorphic types replace the expression's _data ref with a _len ref. From-SVN: r238347
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r--gcc/fortran/simplify.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 95a8d10..8096a92 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -3816,8 +3816,12 @@ gfc_simplify_len (gfc_expr *e, gfc_expr *kind)
}
else if (e->expr_type == EXPR_VARIABLE && e->ts.type == BT_CHARACTER
&& e->symtree->n.sym
+ && e->symtree->n.sym->ts.type != BT_DERIVED
&& e->symtree->n.sym->assoc && e->symtree->n.sym->assoc->target
- && e->symtree->n.sym->assoc->target->ts.type == BT_DERIVED)
+ && e->symtree->n.sym->assoc->target->ts.type == BT_DERIVED
+ && e->symtree->n.sym->assoc->target->symtree->n.sym
+ && UNLIMITED_POLY (e->symtree->n.sym->assoc->target->symtree->n.sym))
+
/* 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. */