diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-09-02 15:08:47 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-09-02 15:08:47 +0000 |
commit | 72a7867c5cb436a3996d577ff5f90a82b13ccb35 (patch) | |
tree | 098d90a8955c710cd5f676bfa6bb6f62bc25a8d1 | |
parent | 88c90cf10be1535c99509f94718b3f3bfcb9ceb1 (diff) | |
download | gcc-72a7867c5cb436a3996d577ff5f90a82b13ccb35.zip gcc-72a7867c5cb436a3996d577ff5f90a82b13ccb35.tar.gz gcc-72a7867c5cb436a3996d577ff5f90a82b13ccb35.tar.bz2 |
multi.c (_gfortran_caf_sync_images): Handle SYNC IMAGGES (*) correctly.
2018-09-02 Thomas Koenig <tkoenig@gcc.gnu.org>
* caf/multi.c (_gfortran_caf_sync_images): Handle
SYNC IMAGGES (*) correctly.
From-SVN: r264041
-rw-r--r-- | libgfortran/ChangeLog.dev | 5 | ||||
-rw-r--r-- | libgfortran/caf/multi.c | 22 |
2 files changed, 18 insertions, 9 deletions
diff --git a/libgfortran/ChangeLog.dev b/libgfortran/ChangeLog.dev index 2256372..d466bec 100644 --- a/libgfortran/ChangeLog.dev +++ b/libgfortran/ChangeLog.dev @@ -1,4 +1,9 @@ 2018-09-02 Thomas Koenig <tkoenig@gcc.gnu.org> + + * caf/multi.c (_gfortran_caf_sync_images): Handle + SYNC IMAGGES (*) correctly. + +2018-09-02 Thomas Koenig <tkoenig@gcc.gnu.org> Nicolas Koenig <koenigni@gcc.gnu.org> * caf/multi.c: Some cleanup. diff --git a/libgfortran/caf/multi.c b/libgfortran/caf/multi.c index d980436e..d02e49d 100644 --- a/libgfortran/caf/multi.c +++ b/libgfortran/caf/multi.c @@ -226,21 +226,24 @@ cond_signal (cond_t *cond) #define A(i,j) (sim[(i) + caf_num_images * (j)]) void -_gfortran_caf_sync_images (int count __attribute__ ((unused)), - int images[] __attribute__ ((unused)), - int *stat, +_gfortran_caf_sync_images (int count, int *images, + int *stat __attribute__ ((unused)), char *errmsg __attribute__ ((unused)), size_t errmsg_len __attribute__ ((unused))) { pthread_mutex_t *my_mutex; + if (count < 0) + count = caf_num_images; + for (int i=0; i < count; i++) { - if (images[i] - 1 != _gfortrani_caf_this_image) + int other_img = images == NULL ? i : images[i] - 1; + if (other_img != _gfortrani_caf_this_image) { - cond_t *other_thread = cim + images[i] - 1; + cond_t *other_thread = cim + other_img; pthread_mutex_lock (&other_thread->mutex); - A(_gfortrani_caf_this_image, images[i] - 1) ++; + A(_gfortrani_caf_this_image, other_img) ++; cond_signal(other_thread); } } @@ -255,10 +258,11 @@ _gfortran_caf_sync_images (int count __attribute__ ((unused)), for (int i = 0; i < count; i++) { - if (images[i] - 1 != _gfortrani_caf_this_image) + int other_img = images == NULL ? i : images[i] - 1; + if (other_img != _gfortrani_caf_this_image) { - x = A(images[i] - 1,_gfortrani_caf_this_image) - < A(_gfortrani_caf_this_image, images[i] - 1); + x = A(other_img, _gfortrani_caf_this_image) + < A(_gfortrani_caf_this_image, other_img); if (x) { do_wait = 1; |