diff options
author | Harris Snyder <hsnyder@structura.bio> | 2021-01-27 22:54:04 +0100 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2021-01-27 22:57:41 +0100 |
commit | 1cdca4261e88f4dc9c3293c6b3c2fff3071ca32b (patch) | |
tree | b60a25cb6e6547d7d44f7d7444d60f5d7c8fd64c /libgfortran/runtime | |
parent | 081c96621da658760b4a67c07530805f770fa22c (diff) | |
download | gcc-1cdca4261e88f4dc9c3293c6b3c2fff3071ca32b.zip gcc-1cdca4261e88f4dc9c3293c6b3c2fff3071ca32b.tar.gz gcc-1cdca4261e88f4dc9c3293c6b3c2fff3071ca32b.tar.bz2 |
Fix strides for C descriptors with stride > 2.
libgfortran/ChangeLog:
* runtime/ISO_Fortran_binding.c (CFI_establish): fixed
strides for rank >2 arrays.
gcc/testsuite/ChangeLog:
* gfortran.dg/ISO_Fortran_binding_18.c: New test.
* gfortran.dg/ISO_Fortran_binding_18.f90: New test.
Diffstat (limited to 'libgfortran/runtime')
-rw-r--r-- | libgfortran/runtime/ISO_Fortran_binding.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libgfortran/runtime/ISO_Fortran_binding.c b/libgfortran/runtime/ISO_Fortran_binding.c index 3746ec1..20833ad 100644 --- a/libgfortran/runtime/ISO_Fortran_binding.c +++ b/libgfortran/runtime/ISO_Fortran_binding.c @@ -391,7 +391,12 @@ int CFI_establish (CFI_cdesc_t *dv, void *base_addr, CFI_attribute_t attribute, if (i == 0) dv->dim[i].sm = dv->elem_len; else - dv->dim[i].sm = (CFI_index_t)(dv->elem_len * extents[i - 1]); + { + CFI_index_t extents_product = 1; + for (int j = 0; j < i; j++) + extents_product *= extents[j]; + dv->dim[i].sm = (CFI_index_t)(dv->elem_len * extents_product); + } } } |