From 781d83d96d15ee03d845d6f2894d1d76ee24e79a Mon Sep 17 00:00:00 2001 From: Andre Vehreschild Date: Wed, 3 Feb 2016 11:39:09 +0100 Subject: re PR fortran/67451 ([F08] ICE with sourced allocation from coarray.) gcc/testsuite/ChangeLog: 2016-02-03 Andre Vehreschild PR fortran/67451 PR fortran/69418 * gfortran.dg/coarray_allocate_2.f08: New test. * gfortran.dg/coarray_allocate_3.f08: New test. * gfortran.dg/coarray_allocate_4.f08: New test. gcc/fortran/ChangeLog: 2016-02-03 Andre Vehreschild PR fortran/67451 PR fortran/69418 * trans-expr.c (gfc_copy_class_to_class): For coarrays just the pointer is passed. Take it as is without trying to deref the _data component. * trans-stmt.c (gfc_trans_allocate): Take care of coarrays as argument to source=-expression. From-SVN: r233101 --- gcc/fortran/trans-expr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/trans-expr.c') diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 08b20e6..87af7ac 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -1103,7 +1103,14 @@ gfc_copy_class_to_class (tree from, tree to, tree nelems, bool unlimited) } else { - from_data = gfc_class_data_get (from); + /* Check that from is a class. When the class is part of a coarray, + then from is a common pointer and is to be used as is. */ + tmp = POINTER_TYPE_P (TREE_TYPE (from)) + ? build_fold_indirect_ref (from) : from; + from_data = + (GFC_CLASS_TYPE_P (TREE_TYPE (tmp)) + || (DECL_P (tmp) && GFC_DECL_CLASS (tmp))) + ? gfc_class_data_get (from) : from; is_from_desc = GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (from_data)); } } -- cgit v1.1