diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 834c17a6d7f75d660149e6703c80f1914b27946e..1727bf0eac77b65809b3b68bedffbef7b5882a74 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-11-13 Tobias Burnus <tobias@codesourcery.com> + + PR fortran/92470 + * gfortran.dg/ISO_Fortran_binding_1.c (establish_c): Add assert for + lower_bound == 0. + 2019-11-13 Richard Sandiford <richard.sandiford@arm.com> * gcc.target/aarch64/sve/mask_struct_store_3.c: Add diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c index 091e754d8f96afce5b3c468a3f0ed8f3b0f74b2d..a5714593c5221a802b622be39c7c5230ab113f62 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c @@ -109,6 +109,7 @@ int establish_c(CFI_cdesc_t * desc) CFI_attribute_pointer, CFI_type_struct, sizeof(t), 1, extent); + assert (desc->dim[0].lower_bound == 0); for (idx[0] = 0; idx[0] < extent[0]; idx[0]++) { res_addr = (t*)CFI_address (desc, idx); diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 1abdd6a4f24e02863e70d0f205cff24dc9f5f374..0727ade0104ab7e49e8cdcc6bfdb58d5395619ea 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2019-11-13 Tobias Burnus <tobias@codesourcery.com> + + PR fortran/92470 + * runtime/ISO_Fortran_binding.c (CFI_establish): Set lower_bound to 0 + also for CFI_attribute_other. + 2019-11-12 Tobias Burnus <tobias@codesourcery.com> PR fortran/92470 diff --git a/libgfortran/runtime/ISO_Fortran_binding.c b/libgfortran/runtime/ISO_Fortran_binding.c index 7ae2a9351da4a0529b4c9315b757c98d3117790a..91d9ae46d3d8a35b5d5505d62a165bd688af49f7 100644 --- a/libgfortran/runtime/ISO_Fortran_binding.c +++ b/libgfortran/runtime/ISO_Fortran_binding.c @@ -387,13 +387,7 @@ int CFI_establish (CFI_cdesc_t *dv, void *base_addr, CFI_attribute_t attribute, for (int i = 0; i < rank; i++) { - /* If the C Descriptor is for a pointer then the lower bounds of every - * dimension are set to zero. */ - if (attribute == CFI_attribute_pointer) - dv->dim[i].lower_bound = 0; - else - dv->dim[i].lower_bound = 1; - + dv->dim[i].lower_bound = 0; dv->dim[i].extent = extents[i]; if (i == 0) dv->dim[i].sm = dv->elem_len;