From 6479f45b31c13f30f1de2ac4ff8d7a0e0084b864 Mon Sep 17 00:00:00 2001 From: Andre Vehreschild Date: Tue, 13 Dec 2016 17:47:48 +0100 Subject: re PR fortran/77785 ([Coarray] ICE in gfc_get_caf_token_offset, at fortran/trans-expr.c:1990) gcc/fortran/ChangeLog: 2016-12-13 Andre Vehreschild PR fortran/77785 * resolve.c (resolve_symbol): Correct attr lookup to the _data component. * trans-array.c (gfc_alloc_allocatable_for_assignment): Indirect ref pointers and references before retrieving the caf-token. gcc/testsuite/ChangeLog: 2016-12-13 Andre Vehreschild PR fortran/77785 * gfortran.dg/coarray_38.f90: Added expecting error message. * gfortran.dg/coarray_41.f90: New test. * gfortran.dg/coarray_class_2.f90: New test. From-SVN: r243614 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/resolve.c | 4 ++-- gcc/fortran/trans-array.c | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2a4b69d..d25fc97 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2016-12-13 Andre Vehreschild + + PR fortran/77785 + * resolve.c (resolve_symbol): Correct attr lookup to the _data + component. + * trans-array.c (gfc_alloc_allocatable_for_assignment): Indirect ref + pointers and references before retrieving the caf-token. + 2016-12-13 Janus Weil Paul Thomas diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index ece4d75..ce1d9ea 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -14044,8 +14044,8 @@ resolve_symbol (gfc_symbol *sym) if (flag_coarray == GFC_FCOARRAY_LIB && sym->ts.type == BT_CLASS && sym->ts.u.derived && CLASS_DATA (sym) && CLASS_DATA (sym)->attr.codimension - && (sym->ts.u.derived->attr.alloc_comp - || sym->ts.u.derived->attr.pointer_comp)) + && (CLASS_DATA (sym)->ts.u.derived->attr.alloc_comp + || CLASS_DATA (sym)->ts.u.derived->attr.pointer_comp)) { gfc_error ("Sorry, allocatable/pointer components in polymorphic (CLASS) " "type coarrays at %L are unsupported", &sym->declared_at); diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 8753cbf..0cd83f4 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -9337,6 +9337,8 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop, if (token == NULL_TREE) { tmp = gfc_get_tree_for_caf_expr (expr1); + if (POINTER_TYPE_P (TREE_TYPE (tmp))) + tmp = build_fold_indirect_ref (tmp); gfc_get_caf_token_offset (&caf_se, &token, NULL, tmp, NULL_TREE, expr1); token = gfc_build_addr_expr (NULL_TREE, token); -- cgit v1.1