diff options
Diffstat (limited to 'libgfortran/intrinsics/iso_c_binding.c')
-rw-r--r-- | libgfortran/intrinsics/iso_c_binding.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/libgfortran/intrinsics/iso_c_binding.c b/libgfortran/intrinsics/iso_c_binding.c index ea1bab39501..d0549b03dfa 100644 --- a/libgfortran/intrinsics/iso_c_binding.c +++ b/libgfortran/intrinsics/iso_c_binding.c @@ -94,11 +94,11 @@ ISO_C_BINDING_PREFIX (c_f_pointer_u0) (void *c_ptr_in, if (shape != NULL) { - index_type source_stride; - index_type size, str; + index_type source_stride, size; + index_type str = 1; char *p; - f_ptr_out->offset = 0; + f_ptr_out->offset = str; shapeSize = 0; p = shape->data; size = GFC_DESCRIPTOR_SIZE(shape); @@ -145,12 +145,7 @@ ISO_C_BINDING_PREFIX (c_f_pointer_u0) (void *c_ptr_in, } p += source_stride; - if (i == 0) - { - str = 1; - f_ptr_out->offset = str; - } - else + if (i != 0) { str = str * GFC_DESCRIPTOR_EXTENT(f_ptr_out,i-1); f_ptr_out->offset += str; |