diff options
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); + } } } |