aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-stmt.c
diff options
context:
space:
mode:
authorAndre Vehreschild <vehre@gcc.gnu.org>2016-02-11 17:48:45 +0100
committerAndre Vehreschild <vehre@gcc.gnu.org>2016-02-11 17:48:45 +0100
commit76fe932be367d60f45e8a69a83d3efcf271f6e63 (patch)
tree4f0f282a748ce12fc4fc2f005187201258537e3f /gcc/fortran/trans-stmt.c
parent564c4d4bb3eea5e84b04af6d8404ca96b0a65807 (diff)
downloadgcc-76fe932be367d60f45e8a69a83d3efcf271f6e63.zip
gcc-76fe932be367d60f45e8a69a83d3efcf271f6e63.tar.gz
gcc-76fe932be367d60f45e8a69a83d3efcf271f6e63.tar.bz2
re PR fortran/69296 ([F03] Problem with associate and vector subscript)
gcc/fortran/ChangeLog: 2016-02-11 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/69296 * gfortran.h: Added flag to gfc_association_list indicating that the rank of an associate variable has been guessed only. * parse.c (parse_associate): Set the guess flag mentioned above when guessing the rank of an expression. * resolve.c (resolve_assoc_var): When the rank has been guessed, make sure, that the guess was correct else overwrite with the actual rank. * trans-stmt.c (trans_associate_var): For subref_array_pointers in class objects, take the span from the _data component. gcc/testsuite/ChangeLog: 2016-02-11 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/69296 * gfortran.dg/associate_19.f03: New test. * gfortran.dg/associate_20.f03: New test. From-SVN: r233351
Diffstat (limited to 'gcc/fortran/trans-stmt.c')
-rw-r--r--gcc/fortran/trans-stmt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 5143c31..cb54499 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -1569,7 +1569,9 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block)
if (sym->attr.subref_array_pointer)
{
gcc_assert (e->expr_type == EXPR_VARIABLE);
- tmp = e->symtree->n.sym->backend_decl;
+ tmp = e->symtree->n.sym->ts.type == BT_CLASS
+ ? gfc_class_data_get (e->symtree->n.sym->backend_decl)
+ : e->symtree->n.sym->backend_decl;
tmp = gfc_get_element_type (TREE_TYPE (tmp));
tmp = fold_convert (gfc_array_index_type, size_in_bytes (tmp));
gfc_add_modify (&se.pre, GFC_DECL_SPAN(desc), tmp);