summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorvehre <vehre@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-07 17:26:58 +0000
committervehre <vehre@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-07 17:26:58 +0000
commit942ef29d2fbd38c9e00addc0b8f2deb732f01a90 (patch)
treef294640f3f31fa5e09df6b9587e7dd3cbfd62c4c /libgfortran
parent32bb76c6b890f38527095491380c1d05142d4588 (diff)
gcc/fortran/ChangeLog:
2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/78781 PR fortran/78935 * expr.c (gfc_check_pointer_assign): Return the same error message for rewritten coarray pointer assignments like for plain ones. * gfortran.h: Change prototype. * primary.c (caf_variable_attr): Set attributes used ones only only ones. Add setting of pointer_comp attribute. (gfc_caf_attr): Add setting of pointer_comp attribute. * trans-array.c (gfc_array_allocate): Add flag that the component to allocate is not an ultimate coarray component. Add allocation of pointer arrays. (structure_alloc_comps): Extend nullify to treat pointer components in coarrays correctly. Restructure nullify to remove redundant code. (gfc_nullify_alloc_comp): Allow setting caf_mode flags. * trans-array.h: Change prototype of gfc_nullify_alloc_comp (). * trans-decl.c (generate_coarray_sym_init): Call nullify_alloc_comp for derived type coarrays with pointer components. * trans-expr.c (gfc_trans_structure_assign): Also treat pointer components. (trans_caf_token_assign): Handle assignment of token of scalar pointer components. (gfc_trans_pointer_assignment): Call above routine. * trans-intrinsic.c (conv_expr_ref_to_caf_ref): Add treating pointer components. (gfc_conv_intrinsic_caf_get): Likewise. (conv_caf_send): Likewise. * trans-stmt.c (gfc_trans_allocate): After allocating a derived type in a coarray pre-register the tokens. (gfc_trans_deallocate): Simply determining the coarray type (scalar or array) and deregistering it correctly. * trans-types.c (gfc_typenode_for_spec): Replace in_coarray flag by the actual codim to allow lookup of array types in the cache. (gfc_build_array_type): Likewise. (gfc_get_array_descriptor_base): Likewise. (gfc_get_array_type_bounds): Likewise. (gfc_get_derived_type): Likewise. * trans-types.h: Likewise. * trans.c (gfc_deallocate_with_status): Enable deregistering of all kind of coarray components. (gfc_deallocate_scalar_with_status): Use free() in fcoarray_single mode instead of caf_deregister. libgfortran/ChangeLog: 2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/78781 PR fortran/78935 * caf/single.c (send_by_ref): Fix addressing of non-allocatable scalar destination components. gcc/testsuite/ChangeLog: 2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org> * gfortran.dg/coarray/ptr_comp_1.f08: New test. * gfortran.dg/coarray/ptr_comp_2.f08: New test. * gfortran.dg/coarray/ptr_comp_3.f08: New test. * gfortran.dg/coarray/ptr_comp_4.f08: New test. * gfortran.dg/coarray_ptr_comp_1.f08: New test. * gfortran.dg/coarray_ptr_comp_2.f08: New test. * gfortran.dg/coarray_ptr_comp_3.f08: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244196 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog7
-rw-r--r--libgfortran/caf/single.c21
2 files changed, 24 insertions, 4 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index f86dd33c7877..f07dff1b8d68 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,10 @@
+2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/78781
+ PR fortran/78935
+ * caf/single.c (send_by_ref): Fix addressing of non-allocatable scalar
+ destination components.
+
2017-01-01 Jakub Jelinek <jakub@redhat.com>
Update copyright years.
diff --git a/libgfortran/caf/single.c b/libgfortran/caf/single.c
index fa50431db42c..cf78a1a48fdb 100644
--- a/libgfortran/caf/single.c
+++ b/libgfortran/caf/single.c
@@ -1953,11 +1953,24 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t *src_index,
}
else
{
- ds = GFC_DESCRIPTOR_DATA (dst);
- dst_type = GFC_DESCRIPTOR_TYPE (dst);
+ single_token = *(caf_single_token_t *)
+ (ds + ref->u.c.caf_token_offset);
+ dst = single_token->desc;
+ if (dst)
+ {
+ ds = GFC_DESCRIPTOR_DATA (dst);
+ dst_type = GFC_DESCRIPTOR_TYPE (dst);
+ }
+ else
+ {
+ /* When no destination descriptor is present, assume that
+ source and dest type are identical. */
+ dst_type = GFC_DESCRIPTOR_TYPE (src);
+ ds = *(void **)(ds + ref->u.c.offset);
+ }
}
copy_data (ds, sr, dst_type, GFC_DESCRIPTOR_TYPE (src),
- dst_kind, src_kind, ref->item_size, src_size, 1, stat);
+ dst_kind, src_kind, ref->item_size, src_size, 1, stat);
}
else
copy_data (ds + ref->u.c.offset, sr,
@@ -2055,7 +2068,7 @@ send_by_ref (caf_reference_t *ref, size_t *i, size_t *src_index,
return;
}
/* Only when on the left most index switch the data pointer to
- the array's data pointer. And only for non-static arrays. */
+ the array's data pointer. And only for non-static arrays. */
if (dst_dim == 0 && ref->type != CAF_REF_STATIC_ARRAY)
ds = GFC_DESCRIPTOR_DATA (dst);
switch (ref->u.a.mode[dst_dim])