diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-11-29 20:01:33 +0100 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-11-29 20:04:26 +0100 |
commit | fd7b341cd0db50fb1ca58599f3442530f7d5a0e5 (patch) | |
tree | 3d622871d312d80c2ebc42f597ab6bbe495f62a1 | |
parent | 1e13c758928fb54115af39cbd50d7c41ab59f5c2 (diff) | |
download | gcc-fd7b341cd0db50fb1ca58599f3442530f7d5a0e5.zip gcc-fd7b341cd0db50fb1ca58599f3442530f7d5a0e5.tar.gz gcc-fd7b341cd0db50fb1ca58599f3442530f7d5a0e5.tar.bz2 |
Yet another offset fix.
-rw-r--r-- | gcc/fortran/trans-array.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index d4f5c3a..26b41ef 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -3021,10 +3021,11 @@ cas_add_this_image_offset (tree offset, tree desc, gfc_array_ref *ar, offset, off); } -/* Return the array ref of the coarray, NULL otherwise. */ +/* Return the array ref of the coarray if an implied THIS_IMAGE() + is needed, NULL otherwise. */ static gfc_ref * -cas_array_ref (gfc_ref *ref) +cas_impl_this_image_ref (gfc_ref *ref) { gcc_assert (flag_coarray == GFC_FCOARRAY_SHARED); @@ -3090,7 +3091,7 @@ gfc_conv_ss_descriptor (stmtblock_t * block, gfc_ss * ss, int base) ref = ss_info->expr->ref; if (flag_coarray == GFC_FCOARRAY_SHARED) { - gfc_ref *co_ref = cas_array_ref (ref); + gfc_ref *co_ref = cas_impl_this_image_ref (ref); if (co_ref) tmp = cas_add_this_image_offset (tmp, se.expr,&co_ref->u.ar, 1, 0); } @@ -3112,11 +3113,13 @@ gfc_conv_ss_descriptor (stmtblock_t * block, gfc_ss * ss, int base) // all of this if (flag_coarray == GFC_FCOARRAY_SHARED) { - gfc_ref *co_ref = cas_array_ref (ref); - if (co_ref) - tmp = cas_add_strides (tmp, se.expr, co_ref->u.ar.as->rank, - co_ref->u.ar.as->rank - + co_ref->u.ar.as->corank); + for (; ref; ref = ref->next) + { + if (ref->type == REF_ARRAY && ref->u.ar.codimen > 0) + tmp = cas_add_strides (tmp, se.expr, ref->u.ar.as->rank, + ref->u.ar.as->rank + + ref->u.ar.as->corank); + } } info->offset = gfc_evaluate_now (tmp, block); @@ -7123,7 +7126,7 @@ gfc_get_dataptr_offset (stmtblock_t *block, tree parm, tree desc, tree offset, /* If it's a coarray with implicit this_image, add that to the offset. */ if (flag_coarray == GFC_FCOARRAY_SHARED) { - gfc_ref *co_ref = cas_array_ref (expr->ref); + gfc_ref *co_ref = cas_impl_this_image_ref (expr->ref); if (co_ref) offset = cas_add_this_image_offset (offset, desc, &co_ref->u.ar, 0, 0); } |