From fe0069ed4d6e61dfcd8e66e227690635ba317d1a Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Wed, 23 Dec 2020 11:40:00 +0100 Subject: Add offset to allocatable shared coarrays. This adds the calculation of the offset for allocatable coarrays, which was missing before, and fixes the resulting fallout for ALLOCATED. Additionally, it prepares the way for STAT and ERRMSG for ALLOCATE of coarrays, but that still needs changes to gfc_trans_allocate. gcc/fortran/ChangeLog: * trans-array.c (gfc_conv_array_ref): If se->address_only is set, throw away all the offset calculation. (gfc_allocate_shared_coarray): Add arguments stat, errmsg and errlen to call to allocate. Calculate offset for allocatable coarrays. (gfc_array_allocate): Adjust call to gfc_allocate_shared_coarray. * trans-array.h (gfc_allocate_shared_coarray): Change prototype of cas_coarray_alloc. * trans-decl.c (gfc_build_builtin_function_decls): Adjust cas_coarray_alloc to changed prototypes. (gfc_trans_shared_coarray): Adjust call to gfc_allocate_shared_coarray. * trans-intrinsic.c (gfc_conv_allocated): Set address_only on se. * trans.h: Add flag address_only to gfc_se. libgfortran/ChangeLog: * caf_shared/wrapper.c (cas_coarray_alloc): Add status, error and errmsg arguments and their checking. --- libgfortran/caf_shared/wrapper.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libgfortran') diff --git a/libgfortran/caf_shared/wrapper.c b/libgfortran/caf_shared/wrapper.c index 4716194..a3d8866 100644 --- a/libgfortran/caf_shared/wrapper.c +++ b/libgfortran/caf_shared/wrapper.c @@ -44,7 +44,8 @@ enum gfc_coarray_allocation_type GFC_NCA_EVENT_COARRAY, }; -void cas_coarray_alloc (gfc_array_void *, int, int, int); +void cas_coarray_alloc (gfc_array_void *, size_t, int, int, int *, + char *, size_t); export_proto (cas_coarray_alloc); void cas_coarray_free (gfc_array_void *, int); @@ -85,8 +86,8 @@ void cas_collsub_broadcast_scalar (void *restrict, size_t, int, int *, char *, export_proto (cas_collsub_broadcast_scalar); void -cas_coarray_alloc (gfc_array_void *desc, int elem_size, int corank, - int alloc_type) +cas_coarray_alloc (gfc_array_void *desc, size_t elem_size, int corank, + int alloc_type, int *status, char *errmsg, size_t errmsg_len) { int i, last_rank_index; int num_coarray_elems, num_elems; /* Excludes the last dimension, because it @@ -98,6 +99,7 @@ cas_coarray_alloc (gfc_array_void *desc, int elem_size, int corank, ensure_initialization (); /* This function might be the first one to be called, if it is called in a constructor. */ + STAT_ERRMSG_ENTRY_CHECK (status, errmsg, errmsg_len); if (alloc_type == GFC_NCA_LOCK_COARRAY) elem_size = sizeof (pthread_mutex_t); else if (alloc_type == GFC_NCA_EVENT_COARRAY) -- cgit v1.1