aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-01-06 14:38:49 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2012-01-06 14:38:49 +0100
commit5d81ddd07fd38a9f20ca9e53fbe1348fa408ec04 (patch)
tree05910d8ab745d35d99205e6d0f724e44cd6dfb7e /libgfortran
parentaf0aec67b86dbdfb04e9c581590bb9ae2b6fea33 (diff)
downloadgcc-5d81ddd07fd38a9f20ca9e53fbe1348fa408ec04.zip
gcc-5d81ddd07fd38a9f20ca9e53fbe1348fa408ec04.tar.gz
gcc-5d81ddd07fd38a9f20ca9e53fbe1348fa408ec04.tar.bz2
2012-01-06 Tobias Burnus <burnus@net-b.de>
* trans-openmp.c (gfc_omp_clause_dtor, * gfc_trans_omp_array_reduction): Update call to gfc_trans_dealloc_allocated. * trans.c (gfc_allocate_using_malloc): Fix spacing. (gfc_allocate_allocatable): For gfc_allocate_using_lib, jump to label_finish when an error occurs. (gfc_deallocate_with_status): Call caf_deregister for -fcoarray=lib. * trans.h (gfc_allocate_allocatable, * gfc_deallocate_with_status): Update prototype. (gfor_fndecl_caf_deregister): New tree symbol. * trans-expr.c (gfc_conv_procedure_call): Update gfc_deallocate_with_status and gfc_trans_dealloc_allocated calls. * trans-array.c (gfc_array_allocate, * gfc_trans_dealloc_allocated, structure_alloc_comps, gfc_trans_deferred_array): Ditto. (gfc_array_deallocate): Handle coarrays with -fcoarray=lib. * trans-array.h (gfc_array_deallocate, gfc_array_allocate, gfc_trans_dealloc_allocated): Update prototypes. * trans-stmt.c (gfc_trans_sync): Fix indentation. (gfc_trans_allocate): Fix errmsg padding and label handling. (gfc_trans_deallocate): Ditto and handle -fcoarray=lib. * expr.c (gfc_is_coarray): Fix algorithm for BT_CLASS. * libgfortran.h (GFC_STAT_STOPPED_IMAGE): Use large value to avoid other stats accidentally matching this one. * trans-decl.c (gfor_fndecl_caf_deregister): New global var. (gfc_build_builtin_function_decls): Fix prototype decl of caf_register and add decl for caf_deregister. (gfc_trans_deferred_vars): Handle CAF vars with -fcoarrays=lib. * trans-intrinsic.c (conv_intrinsic_move_alloc): Update call to gfc_deallocate_with_status. 2012-01-06 Tobias Burnus <burnus@net-b.de> * caf/single.c (_gfortran_caf_register, * _gfortran_caf_deregister): Fix token handling. * caf/mpi.c (_gfortran_caf_register, _gfortran_caf_deregister): * Ditto. * caf/libcaf.h (STAT_STOPPED_IMAGE): Sync with libgfortran.h. (_gfortran_caf_register, _gfortran_caf_deregister): Update prototype. 2012-01-06 Tobias Burnus <burnus@net-b.de> * gfortran.dg/deallocate_stat_2.f90: New. * coarray/allocate_errgmsg.f90: New. * gfortran.dg/coarray_lib_alloc_1.f90: New. * gfortran.dg/coarray_lib_alloc_2.f90: New. * coarray/subobject_1.f90: Fix for num_images > 1. * gfortran.dg/deallocate_stat.f90: Update due to changed stat= handling. From-SVN: r182951
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog8
-rw-r--r--libgfortran/caf/libcaf.h8
-rw-r--r--libgfortran/caf/mpi.c21
-rw-r--r--libgfortran/caf/single.c14
4 files changed, 30 insertions, 21 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index f516bad..f6b2a16 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,11 @@
+2012-01-06 Tobias Burnus <burnus@net-b.de>
+
+ * caf/single.c (_gfortran_caf_register, _gfortran_caf_deregister):
+ Fix token handling.
+ * caf/mpi.c (_gfortran_caf_register, _gfortran_caf_deregister): Ditto.
+ * caf/libcaf.h (STAT_STOPPED_IMAGE): Sync with libgfortran.h.
+ (_gfortran_caf_register, _gfortran_caf_deregister): Update prototype.
+
2011-12-22 Janne Blomqvist <jb@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
diff --git a/libgfortran/caf/libcaf.h b/libgfortran/caf/libcaf.h
index e6be7ce..caffe17 100644
--- a/libgfortran/caf/libcaf.h
+++ b/libgfortran/caf/libcaf.h
@@ -1,5 +1,5 @@
/* Common declarations for all of GNU Fortran libcaf implementations.
- Copyright (C) 2011
+ Copyright (C) 2011, 2012
Free Software Foundation, Inc.
Contributed by Tobias Burnus <burnus@net-b.de>
@@ -44,7 +44,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define STAT_UNLOCKED 0
#define STAT_LOCKED 1
#define STAT_LOCKED_OTHER_IMAGE 2
-#define STAT_STOPPED_IMAGE 3
+#define STAT_STOPPED_IMAGE 6000
/* Describes what type of array we are registerring. Keep in sync with
gcc/fortran/trans.h. */
@@ -67,9 +67,9 @@ caf_static_t;
void _gfortran_caf_init (int *, char ***, int *, int *);
void _gfortran_caf_finalize (void);
-void * _gfortran_caf_register (ptrdiff_t, caf_register_t, void **, int *,
+void * _gfortran_caf_register (ptrdiff_t, caf_register_t, void ***, int *,
char *, int);
-void _gfortran_caf_deregister (void **, int *, char *, int);
+void _gfortran_caf_deregister (void ***, int *, char *, int);
void _gfortran_caf_sync_all (int *, char *, int);
diff --git a/libgfortran/caf/mpi.c b/libgfortran/caf/mpi.c
index c69c5b9..8c9f07b 100644
--- a/libgfortran/caf/mpi.c
+++ b/libgfortran/caf/mpi.c
@@ -1,5 +1,5 @@
/* MPI implementation of GNU Fortran Coarray Library
- Copyright (C) 2011
+ Copyright (C) 2011, 2012
Free Software Foundation, Inc.
Contributed by Tobias Burnus <burnus@net-b.de>
@@ -119,7 +119,7 @@ _gfortran_caf_finalize (void)
void *
-_gfortran_caf_register (ptrdiff_t size, caf_register_t type, void **token,
+_gfortran_caf_register (ptrdiff_t size, caf_register_t type, void ***token,
int *stat, char *errmsg, int errmsg_len)
{
void *local;
@@ -134,18 +134,19 @@ _gfortran_caf_register (ptrdiff_t size, caf_register_t type, void **token,
/* Token contains only a list of pointers. */
local = malloc (size);
- token = malloc (sizeof (void*) * caf_num_images);
+ *token = malloc (sizeof (void*) * caf_num_images);
- if (unlikely (local == NULL || token == NULL))
+ if (unlikely (local == NULL || *token == NULL))
goto error;
/* token[img-1] is the address of the token in image "img". */
- err = MPI_Allgather (&local, sizeof (void*), MPI_BYTE, token,
+ err = MPI_Allgather (&local, sizeof (void*), MPI_BYTE, *token,
sizeof (void*), MPI_BYTE, MPI_COMM_WORLD);
+
if (unlikely (err))
{
free (local);
- free (token);
+ free (*token);
goto error;
}
@@ -153,7 +154,7 @@ _gfortran_caf_register (ptrdiff_t size, caf_register_t type, void **token,
{
caf_static_t *tmp = malloc (sizeof (caf_static_t));
tmp->prev = caf_static_list;
- tmp->token = token;
+ tmp->token = *token;
caf_static_list = tmp;
}
@@ -192,7 +193,7 @@ error:
void
-_gfortran_caf_deregister (void **token, int *stat, char *errmsg, int errmsg_len)
+_gfortran_caf_deregister (void ***token, int *stat, char *errmsg, int errmsg_len)
{
if (unlikely (caf_is_finalized))
{
@@ -220,8 +221,8 @@ _gfortran_caf_deregister (void **token, int *stat, char *errmsg, int errmsg_len)
if (stat)
*stat = 0;
- free (token[caf_this_image-1]);
- free (token);
+ free ((*token)[caf_this_image-1]);
+ free (*token);
}
diff --git a/libgfortran/caf/single.c b/libgfortran/caf/single.c
index 5353c7b..4242fad 100644
--- a/libgfortran/caf/single.c
+++ b/libgfortran/caf/single.c
@@ -1,5 +1,5 @@
/* Single-image implementation of GNU Fortran Coarray Library
- Copyright (C) 2011
+ Copyright (C) 2011, 2012
Free Software Foundation, Inc.
Contributed by Tobias Burnus <burnus@net-b.de>
@@ -81,14 +81,14 @@ _gfortran_caf_finalize (void)
void *
-_gfortran_caf_register (ptrdiff_t size, caf_register_t type, void **token,
+_gfortran_caf_register (ptrdiff_t size, caf_register_t type, void ***token,
int *stat, char *errmsg, int errmsg_len)
{
void *local;
local = malloc (size);
- token = malloc (sizeof (void*) * 1);
- token[0] = local;
+ *token = malloc (sizeof (void*) * 1);
+ (*token)[0] = local;
if (unlikely (local == NULL || token == NULL))
{
@@ -117,7 +117,7 @@ _gfortran_caf_register (ptrdiff_t size, caf_register_t type, void **token,
{
caf_static_t *tmp = malloc (sizeof (caf_static_t));
tmp->prev = caf_static_list;
- tmp->token = token;
+ tmp->token = *token;
caf_static_list = tmp;
}
return local;
@@ -125,12 +125,12 @@ _gfortran_caf_register (ptrdiff_t size, caf_register_t type, void **token,
void
-_gfortran_caf_deregister (void **token, int *stat,
+_gfortran_caf_deregister (void ***token, int *stat,
char *errmsg __attribute__ ((unused)),
int errmsg_len __attribute__ ((unused)))
{
+ free ((*token)[0]);
free (*token);
- free (token);
if (stat)
*stat = 0;