diff options
336 files changed, 9238 insertions, 9583 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 51065ae..4b4a353 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,455 @@ +2009-06-21 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/37577 + Port from fortran-dev + * runtime/in_pack_generic (internal_pack): Remove unnecessary + test for stride == 0. + * runtime/in_unpack_generic.c (internal_unpack): Likewise. + * intrinsics/iso_c_binding.c (c_f_pointer_u0): Take care + of stride in "shape" argument. Use array access macros for + accessing array descriptors. + * libgfortran.h (struct descriptor_dimension): Change stride + to _stride, lbound to _lbound and ubound to _ubound. + (GFC_DIMENSION_LBOUND): Use new name(s) in struct + descriptor_dimension. + (GFC_DIMENSION_UBOUND): Likewise. + (GFC_DIMENSION_STRIDE): Likewise. + (GFC_DIMENSION_EXTENT): Likewise. + (GFC_DIMENSION_SET): Likewise. + (GFC_DESCRIPTOR_LBOUND): Likewise. + (GFC_DESCRIPTOR_UBOUND): Likewise. + (GFC_DESCRIPTOR_EXTENT): Likewise. + (GFC_DESCRIPTOR_STRIDE): Likewise. + * io/transfer.c (transfer_array): Use array access macros. + Use byte-sized strides. + * intrinsics/eoshift0.c (eoshift0): Use array access + macros everywhere. + * m4/in_pack.m4 (internal_pack_'rtype_ccode`): Use + array access macros for accessing array descriptors. + * m4/in_unpack.m4 (internal_unpack_'rtype_ccode`): + Likewise. + * m4/matmull.m4 (matmul_'rtype_code`): Likewise. + * m4/matmul.m4 (matmul_'rtype_code`): Likewise. + * m4/unpack.m4 (unpack0_'rtype_code`): Likewise. + (unpack1_'rtype_code`): Likewise. + * m4/ifunction_logical.m4 (name`'rtype_qual`_'atype_code): Likewise. + * m4/ifunction.m4 (name`'rtype_qual`_'atype_code): Use array access + macros everywhere. + * intrinsics/dtime.c (dtime_sub): Use array access macros + for accessing array descriptors. + * intrinsics/cshift0 (cshift0): Likewise. + * intrinsics/etime.c: Likewise. Remove redundant calculation + of rdim. + * m4/cshift0.m4 (cshift0_'rtype_code`): Use array access macros + for accessing array descriptors. + * m4/pack.m4 (pack_'rtype_code`): Likewise. + * m4/spread.m4 (spread_'rtype_code`): Likewise. + (spread_scalar_'rtype_code`): Likewise. + * m4/transpose.m4 (transpose_'rtype_code`): Likewise. + * m4/iforeach.m4 (name`'rtype_qual`_'atype_code): Likewise. + * m4/eoshift1.m4 (eoshift1): Likewise. Remove size argument, + calculate within function. + (eoshift1_'atype_kind`): Remove size argument from call + to eoshift1. + (eoshift1_'atype_kind`_char): Likewise. + (eoshift1_'atype_kind`_char4): Likewise. + * m4/eoshift3.m4 (eoshift3): Remove size argument, calculate + within function. Use array access macros for accessing array + descriptors. + (eoshift3_'atype_kind`): Remove size argument from call + to eoshift1. + (eoshift3_'atype_kind`_char): Likewise. + (eoshift3_'atype_kind`_char4): Likewise. + * m4/shape.m4 (shape_'rtype_kind`): Use array access macros + for accessing array descriptors. + * m4/cshift1.m4 (cshift1): Remove size argument, calculate + within function. Use array access macros for accessing array + descriptors. + (cshift1_'atype_kind`): Remove size argument from call to + cshift1. + (cshift1_'atype_kind`_char): Remove size argument from call to + cshift1. + (cshift1_'atype_kind`_char4): Remove size argument from call to + cshift1. + * m4/reshape.m4 (reshape_'rtype_ccode`): Use array access macros + for accessing array descriptors. + * m4/ifunction.m4 (name`'rtype_qual`_'atype_code): Likewise. + * intrinsics/pack_generic.c (pack_internal): Use array access + macros for accessing array descriptors. + (pack_s_internal): Likewise. + * intrinsics/transpose_generic.c (transpose_internal): Remove + size argument, calculate from array descriptor. Use array + access macros for accessing array descriptors. + (transpose): Remove size argument from call. + (transpoe_char): Likewise. + (transpose_char4): Likewise. + * intrinsics/move_alloc.c (move_alloc): Use array access macros + for accessing array descriptors. + * intrinsics/spread_generic.c (spread_internal): Remove size + argument, calculate from array descriptor. Use array access + macros for accessing array descriptors. + (spread_internal_scalar): Likewise. + (spread): Remove size argument from call to spread_internal. + (spread_char): Mark argument source_length as unused. + Remove size argument from call to spread_internal. + (spread_char4): Likewise. + (spread_char_scalar): Likewise. + (spread_char4_scalar): Likewise. + * intrinsics/unpack_generic.c (unpack_internal): Use array access + macros for accessing array descriptors. + * intrinsics/eoshift2.c (eoshift2): Remove size argument, calculate + from array descriptor instead. Use array access macros for + accessing array descriptors. + (eoshift2_##N): Remove size argument from call to eoshift2. + (eoshift2_##N_##char): Likewise. + (eoshift2_##N_##char4): Likewise. + * intrinsics/reshape_generic.c (reshape_internal): Use array + access macross for accessing array descriptors. + * libgfortran.h: Introduce new macros GFC_DIMENSION_LBOUND, + GFC_DIMENSION_UBOUND,GFC_DIMENSION_STRIDE, GFC_DIMENSION_EXTENT, + GFC_DIMENSION_SET, GFC_DESCRIPTOR_LBOUND, GFC_DESCRIPTOR_UBOUND, + GFC_DESCRIPTOR_EXTENT, GFC_DESCRIPTOR_EXTENT_BYTES, + GFC_DESCRIPTOR_STRIDE, GFC_DESCRIPTOR_STRIDE_BYTES + * runtime/in_pack_generic.c (internal_pack): Use new macros + for array descriptor access. + * runtime/in_unpack_generic.c (internal_unpack): Likewise. + * intrinsics/dtime.c (dtime_sub): Likewise. + * intrinsics/cshift0 (cshift0): Remove argument size, + calculate directly from the array descriptor. Use new macros + for array descriptor access. + * cshift0_##N: Remove shift argument in call to cshift0. + * cshift0_##N_char: Mark array_length as unused. Remove + array_length in call to cshift0. + * cshift0_##N_char4: Likewise. + * intrisics/etime.c: Use new macros for array descriptor access. + * intrinsics/stat.c (stat_i4_sub_0): Likewise. + (stat_i8_sub_0): Likewise. + (fstat_i4_sub): Likewise. + (fstat_i8_sub): Likewise. + * intrinsics/date_and_time.c (date_and_time): Likewise. + (secnds): Likewise. + (itime_i4): Likewise. + (itime_i8): Likewise. + (idate_i4): Likewise. + (idate_i8): Likewise. + (gmtime_i4): Likewise. + (gmtime_i8): Likewise. + (ltime_i4): Likewise. + (litme_i8): Likewise. + * intrinsics/associated.c (associated): Likewise. + * intrinsics/eoshift0.c (eoshift0): Likewise. + * intriniscs/size.c (size0): Likewise. + * intrinsics/random.c (arandom_r4): Likewise. + (arandom_r8): Likewise. + (arandom_r10): Likewise. + (arandom_r16): Likewise. + (random_seed_i4): Likewise. + (random_seed_i8): Likewise. + * io/list_read.c (nml_parse_qualifier): Likewise. + (nml_touch_nodes): Likewise. + (nml_read_obj): Likewise. + (get_name): Likewise. + * io/transfer.c (transfer_array): Likewise. + (init_loop_spec): Likewise. + (st_set_nml_var_dim): Likewise. + * io/write.c (nml_write_obj): Likewise. + (obj_loop): Likewise. + * generated/all_l1.c: Regenerated. + * generated/all_l16.c: Regenerated. + * generated/all_l2.c: Regenerated. + * generated/all_l4.c: Regenerated. + * generated/all_l8.c: Regenerated. + * generated/any_l1.c: Regenerated. + * generated/any_l16.c: Regenerated. + * generated/any_l2.c: Regenerated. + * generated/any_l4.c: Regenerated. + * generated/any_l8.c: Regenerated. + * generated/count_16_l.c: Regenerated. + * generated/count_1_l.c: Regenerated. + * generated/count_2_l.c: Regenerated. + * generated/count_4_l.c: Regenerated. + * generated/count_8_l.c: Regenerated. + * generated/cshift0_c10.c: Regenerated. + * generated/cshift0_c16.c: Regenerated. + * generated/cshift0_c4.c: Regenerated. + * generated/cshift0_c8.c: Regenerated. + * generated/cshift0_i1.c: Regenerated. + * generated/cshift0_i16.c: Regenerated. + * generated/cshift0_i2.c: Regenerated. + * generated/cshift0_i4.c: Regenerated. + * generated/cshift0_i8.c: Regenerated. + * generated/cshift0_r10.c: Regenerated. + * generated/cshift0_r16.c: Regenerated. + * generated/cshift0_r4.c: Regenerated. + * generated/cshift0_r8.c: Regenerated. + * generated/cshift1_16.c: Regenerated. + * generated/cshift1_4.c: Regenerated. + * generated/cshift1_8.c: Regenerated. + * generated/eoshift1_16.c: Regenerated. + * generated/eoshift1_4.c: Regenerated. + * generated/eoshift1_8.c: Regenerated. + * generated/eoshift3_16.c: Regenerated. + * generated/eoshift3_4.c: Regenerated. + * generated/eoshift3_8.c: Regenerated. + * generated/in_pack_c10.c: Regenerated. + * generated/in_pack_c16.c: Regenerated. + * generated/in_pack_c4.c: Regenerated. + * generated/in_pack_c8.c: Regenerated. + * generated/in_pack_i1.c: Regenerated. + * generated/in_pack_i16.c: Regenerated. + * generated/in_pack_i2.c: Regenerated. + * generated/in_pack_i4.c: Regenerated. + * generated/in_pack_i8.c: Regenerated. + * generated/in_pack_r10.c: Regenerated. + * generated/in_pack_r16.c: Regenerated. + * generated/in_pack_r4.c: Regenerated. + * generated/in_pack_r8.c: Regenerated. + * generated/in_unpack_c10.c: Regenerated. + * generated/in_unpack_c16.c: Regenerated. + * generated/in_unpack_c4.c: Regenerated. + * generated/in_unpack_c8.c: Regenerated. + * generated/in_unpack_i1.c: Regenerated. + * generated/in_unpack_i16.c: Regenerated. + * generated/in_unpack_i2.c: Regenerated. + * generated/in_unpack_i4.c: Regenerated. + * generated/in_unpack_i8.c: Regenerated. + * generated/in_unpack_r10.c: Regenerated. + * generated/in_unpack_r16.c: Regenerated. + * generated/in_unpack_r4.c: Regenerated. + * generated/in_unpack_r8.c: Regenerated. + * generated/matmul_c10.c: Regenerated. + * generated/matmul_c16.c: Regenerated. + * generated/matmul_c4.c: Regenerated. + * generated/matmul_c8.c: Regenerated. + * generated/matmul_i1.c: Regenerated. + * generated/matmul_i16.c: Regenerated. + * generated/matmul_i2.c: Regenerated. + * generated/matmul_i4.c: Regenerated. + * generated/matmul_i8.c: Regenerated. + * generated/matmul_l16.c: Regenerated. + * generated/matmul_l4.c: Regenerated. + * generated/matmul_l8.c: Regenerated. + * generated/matmul_r10.c: Regenerated. + * generated/matmul_r16.c: Regenerated. + * generated/matmul_r4.c: Regenerated. + * generated/matmul_r8.c: Regenerated. + * generated/maxloc0_16_i1.c: Regenerated. + * generated/maxloc0_16_i16.c: Regenerated. + * generated/maxloc0_16_i2.c: Regenerated. + * generated/maxloc0_16_i4.c: Regenerated. + * generated/maxloc0_16_i8.c: Regenerated. + * generated/maxloc0_16_r10.c: Regenerated. + * generated/maxloc0_16_r16.c: Regenerated. + * generated/maxloc0_16_r4.c: Regenerated. + * generated/maxloc0_16_r8.c: Regenerated. + * generated/maxloc0_4_i1.c: Regenerated. + * generated/maxloc0_4_i16.c: Regenerated. + * generated/maxloc0_4_i2.c: Regenerated. + * generated/maxloc0_4_i4.c: Regenerated. + * generated/maxloc0_4_i8.c: Regenerated. + * generated/maxloc0_4_r10.c: Regenerated. + * generated/maxloc0_4_r16.c: Regenerated. + * generated/maxloc0_4_r4.c: Regenerated. + * generated/maxloc0_4_r8.c: Regenerated. + * generated/maxloc0_8_i1.c: Regenerated. + * generated/maxloc0_8_i16.c: Regenerated. + * generated/maxloc0_8_i2.c: Regenerated. + * generated/maxloc0_8_i4.c: Regenerated. + * generated/maxloc0_8_i8.c: Regenerated. + * generated/maxloc0_8_r10.c: Regenerated. + * generated/maxloc0_8_r16.c: Regenerated. + * generated/maxloc0_8_r4.c: Regenerated. + * generated/maxloc0_8_r8.c: Regenerated. + * generated/maxloc1_16_i1.c: Regenerated. + * generated/maxloc1_16_i16.c: Regenerated. + * generated/maxloc1_16_i2.c: Regenerated. + * generated/maxloc1_16_i4.c: Regenerated. + * generated/maxloc1_16_i8.c: Regenerated. + * generated/maxloc1_16_r10.c: Regenerated. + * generated/maxloc1_16_r16.c: Regenerated. + * generated/maxloc1_16_r4.c: Regenerated. + * generated/maxloc1_16_r8.c: Regenerated. + * generated/maxloc1_4_i1.c: Regenerated. + * generated/maxloc1_4_i16.c: Regenerated. + * generated/maxloc1_4_i2.c: Regenerated. + * generated/maxloc1_4_i4.c: Regenerated. + * generated/maxloc1_4_i8.c: Regenerated. + * generated/maxloc1_4_r10.c: Regenerated. + * generated/maxloc1_4_r16.c: Regenerated. + * generated/maxloc1_4_r4.c: Regenerated. + * generated/maxloc1_4_r8.c: Regenerated. + * generated/maxloc1_8_i1.c: Regenerated. + * generated/maxloc1_8_i16.c: Regenerated. + * generated/maxloc1_8_i2.c: Regenerated. + * generated/maxloc1_8_i4.c: Regenerated. + * generated/maxloc1_8_i8.c: Regenerated. + * generated/maxloc1_8_r10.c: Regenerated. + * generated/maxloc1_8_r16.c: Regenerated. + * generated/maxloc1_8_r4.c: Regenerated. + * generated/maxloc1_8_r8.c: Regenerated. + * generated/maxval_i1.c: Regenerated. + * generated/maxval_i16.c: Regenerated. + * generated/maxval_i2.c: Regenerated. + * generated/maxval_i4.c: Regenerated. + * generated/maxval_i8.c: Regenerated. + * generated/maxval_r10.c: Regenerated. + * generated/maxval_r16.c: Regenerated. + * generated/maxval_r4.c: Regenerated. + * generated/maxval_r8.c: Regenerated. + * generated/minloc0_16_i1.c: Regenerated. + * generated/minloc0_16_i16.c: Regenerated. + * generated/minloc0_16_i2.c: Regenerated. + * generated/minloc0_16_i4.c: Regenerated. + * generated/minloc0_16_i8.c: Regenerated. + * generated/minloc0_16_r10.c: Regenerated. + * generated/minloc0_16_r16.c: Regenerated. + * generated/minloc0_16_r4.c: Regenerated. + * generated/minloc0_16_r8.c: Regenerated. + * generated/minloc0_4_i1.c: Regenerated. + * generated/minloc0_4_i16.c: Regenerated. + * generated/minloc0_4_i2.c: Regenerated. + * generated/minloc0_4_i4.c: Regenerated. + * generated/minloc0_4_i8.c: Regenerated. + * generated/minloc0_4_r10.c: Regenerated. + * generated/minloc0_4_r16.c: Regenerated. + * generated/minloc0_4_r4.c: Regenerated. + * generated/minloc0_4_r8.c: Regenerated. + * generated/minloc0_8_i1.c: Regenerated. + * generated/minloc0_8_i16.c: Regenerated. + * generated/minloc0_8_i2.c: Regenerated. + * generated/minloc0_8_i4.c: Regenerated. + * generated/minloc0_8_i8.c: Regenerated. + * generated/minloc0_8_r10.c: Regenerated. + * generated/minloc0_8_r16.c: Regenerated. + * generated/minloc0_8_r4.c: Regenerated. + * generated/minloc0_8_r8.c: Regenerated. + * generated/minloc1_16_i1.c: Regenerated. + * generated/minloc1_16_i16.c: Regenerated. + * generated/minloc1_16_i2.c: Regenerated. + * generated/minloc1_16_i4.c: Regenerated. + * generated/minloc1_16_i8.c: Regenerated. + * generated/minloc1_16_r10.c: Regenerated. + * generated/minloc1_16_r16.c: Regenerated. + * generated/minloc1_16_r4.c: Regenerated. + * generated/minloc1_16_r8.c: Regenerated. + * generated/minloc1_4_i1.c: Regenerated. + * generated/minloc1_4_i16.c: Regenerated. + * generated/minloc1_4_i2.c: Regenerated. + * generated/minloc1_4_i4.c: Regenerated. + * generated/minloc1_4_i8.c: Regenerated. + * generated/minloc1_4_r10.c: Regenerated. + * generated/minloc1_4_r16.c: Regenerated. + * generated/minloc1_4_r4.c: Regenerated. + * generated/minloc1_4_r8.c: Regenerated. + * generated/minloc1_8_i1.c: Regenerated. + * generated/minloc1_8_i16.c: Regenerated. + * generated/minloc1_8_i2.c: Regenerated. + * generated/minloc1_8_i4.c: Regenerated. + * generated/minloc1_8_i8.c: Regenerated. + * generated/minloc1_8_r10.c: Regenerated. + * generated/minloc1_8_r16.c: Regenerated. + * generated/minloc1_8_r4.c: Regenerated. + * generated/minloc1_8_r8.c: Regenerated. + * generated/minval_i1.c: Regenerated. + * generated/minval_i16.c: Regenerated. + * generated/minval_i2.c: Regenerated. + * generated/minval_i4.c: Regenerated. + * generated/minval_i8.c: Regenerated. + * generated/minval_r10.c: Regenerated. + * generated/minval_r16.c: Regenerated. + * generated/minval_r4.c: Regenerated. + * generated/minval_r8.c: Regenerated. + * generated/pack_c10.c: Regenerated. + * generated/pack_c16.c: Regenerated. + * generated/pack_c4.c: Regenerated. + * generated/pack_c8.c: Regenerated. + * generated/pack_i1.c: Regenerated. + * generated/pack_i16.c: Regenerated. + * generated/pack_i2.c: Regenerated. + * generated/pack_i4.c: Regenerated. + * generated/pack_i8.c: Regenerated. + * generated/pack_r10.c: Regenerated. + * generated/pack_r16.c: Regenerated. + * generated/pack_r4.c: Regenerated. + * generated/pack_r8.c: Regenerated. + * generated/product_c10.c: Regenerated. + * generated/product_c16.c: Regenerated. + * generated/product_c4.c: Regenerated. + * generated/product_c8.c: Regenerated. + * generated/product_i1.c: Regenerated. + * generated/product_i16.c: Regenerated. + * generated/product_i2.c: Regenerated. + * generated/product_i4.c: Regenerated. + * generated/product_i8.c: Regenerated. + * generated/product_r10.c: Regenerated. + * generated/product_r16.c: Regenerated. + * generated/product_r4.c: Regenerated. + * generated/product_r8.c: Regenerated. + * generated/reshape_c10.c: Regenerated. + * generated/reshape_c16.c: Regenerated. + * generated/reshape_c4.c: Regenerated. + * generated/reshape_c8.c: Regenerated. + * generated/reshape_i16.c: Regenerated. + * generated/reshape_i4.c: Regenerated. + * generated/reshape_i8.c: Regenerated. + * generated/reshape_r10.c: Regenerated. + * generated/reshape_r16.c: Regenerated. + * generated/reshape_r4.c: Regenerated. + * generated/reshape_r8.c: Regenerated. + * generated/shape_i16.c: Regenerated. + * generated/shape_i4.c: Regenerated. + * generated/shape_i8.c: Regenerated. + * generated/spread_c10.c: Regenerated. + * generated/spread_c16.c: Regenerated. + * generated/spread_c4.c: Regenerated. + * generated/spread_c8.c: Regenerated. + * generated/spread_i1.c: Regenerated. + * generated/spread_i16.c: Regenerated. + * generated/spread_i2.c: Regenerated. + * generated/spread_i4.c: Regenerated. + * generated/spread_i8.c: Regenerated. + * generated/spread_r10.c: Regenerated. + * generated/spread_r16.c: Regenerated. + * generated/spread_r4.c: Regenerated. + * generated/spread_r8.c: Regenerated. + * generated/sum_c10.c: Regenerated. + * generated/sum_c16.c: Regenerated. + * generated/sum_c4.c: Regenerated. + * generated/sum_c8.c: Regenerated. + * generated/sum_i1.c: Regenerated. + * generated/sum_i16.c: Regenerated. + * generated/sum_i2.c: Regenerated. + * generated/sum_i4.c: Regenerated. + * generated/sum_i8.c: Regenerated. + * generated/sum_r10.c: Regenerated. + * generated/sum_r16.c: Regenerated. + * generated/sum_r4.c: Regenerated. + * generated/sum_r8.c: Regenerated. + * generated/transpose_c10.c: Regenerated. + * generated/transpose_c16.c: Regenerated. + * generated/transpose_c4.c: Regenerated. + * generated/transpose_c8.c: Regenerated. + * generated/transpose_i16.c: Regenerated. + * generated/transpose_i4.c: Regenerated. + * generated/transpose_i8.c: Regenerated. + * generated/transpose_r10.c: Regenerated. + * generated/transpose_r16.c: Regenerated. + * generated/transpose_r4.c: Regenerated. + * generated/transpose_r8.c: Regenerated. + * generated/unpack_c10.c: Regenerated. + * generated/unpack_c16.c: Regenerated. + * generated/unpack_c4.c: Regenerated. + * generated/unpack_c8.c: Regenerated. + * generated/unpack_i1.c: Regenerated. + * generated/unpack_i16.c: Regenerated. + * generated/unpack_i2.c: Regenerated. + * generated/unpack_i4.c: Regenerated. + * generated/unpack_i8.c: Regenerated. + * generated/unpack_r10.c: Regenerated. + * generated/unpack_r16.c: Regenerated. + * generated/unpack_r4.c: Regenerated. + * generated/unpack_r8.c: Regenerated. + 2009-06-14 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> * fmain.c (main): Don't PREFIX set_args. diff --git a/libgfortran/generated/all_l1.c b/libgfortran/generated/all_l1.c index afde913..486bab2 100644 --- a/libgfortran/generated/all_l1.c +++ b/libgfortran/generated/all_l1.c @@ -60,25 +60,24 @@ all_l1 (gfc_array_l1 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ all_l1 (gfc_array_l1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ all_l1 (gfc_array_l1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " ALL intrinsic in dimension %d:" @@ -142,7 +140,7 @@ all_l1 (gfc_array_l1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/all_l16.c b/libgfortran/generated/all_l16.c index 422fb89..35f8a96 100644 --- a/libgfortran/generated/all_l16.c +++ b/libgfortran/generated/all_l16.c @@ -60,25 +60,24 @@ all_l16 (gfc_array_l16 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ all_l16 (gfc_array_l16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ all_l16 (gfc_array_l16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " ALL intrinsic in dimension %d:" @@ -142,7 +140,7 @@ all_l16 (gfc_array_l16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/all_l2.c b/libgfortran/generated/all_l2.c index 00f0886..81532ea 100644 --- a/libgfortran/generated/all_l2.c +++ b/libgfortran/generated/all_l2.c @@ -60,25 +60,24 @@ all_l2 (gfc_array_l2 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ all_l2 (gfc_array_l2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ all_l2 (gfc_array_l2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " ALL intrinsic in dimension %d:" @@ -142,7 +140,7 @@ all_l2 (gfc_array_l2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/all_l4.c b/libgfortran/generated/all_l4.c index 500d4a5..6657e15 100644 --- a/libgfortran/generated/all_l4.c +++ b/libgfortran/generated/all_l4.c @@ -60,25 +60,24 @@ all_l4 (gfc_array_l4 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ all_l4 (gfc_array_l4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ all_l4 (gfc_array_l4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " ALL intrinsic in dimension %d:" @@ -142,7 +140,7 @@ all_l4 (gfc_array_l4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/all_l8.c b/libgfortran/generated/all_l8.c index 90f287cc..4c3d556 100644 --- a/libgfortran/generated/all_l8.c +++ b/libgfortran/generated/all_l8.c @@ -60,25 +60,24 @@ all_l8 (gfc_array_l8 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ all_l8 (gfc_array_l8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ all_l8 (gfc_array_l8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " ALL intrinsic in dimension %d:" @@ -142,7 +140,7 @@ all_l8 (gfc_array_l8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/any_l1.c b/libgfortran/generated/any_l1.c index 0186730..a69f22e 100644 --- a/libgfortran/generated/any_l1.c +++ b/libgfortran/generated/any_l1.c @@ -60,25 +60,24 @@ any_l1 (gfc_array_l1 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ any_l1 (gfc_array_l1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ any_l1 (gfc_array_l1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " ANY intrinsic in dimension %d:" @@ -142,7 +140,7 @@ any_l1 (gfc_array_l1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/any_l16.c b/libgfortran/generated/any_l16.c index 13f78a0..b5ab5b2 100644 --- a/libgfortran/generated/any_l16.c +++ b/libgfortran/generated/any_l16.c @@ -60,25 +60,24 @@ any_l16 (gfc_array_l16 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ any_l16 (gfc_array_l16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ any_l16 (gfc_array_l16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " ANY intrinsic in dimension %d:" @@ -142,7 +140,7 @@ any_l16 (gfc_array_l16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/any_l2.c b/libgfortran/generated/any_l2.c index b37d9cb..05673e8 100644 --- a/libgfortran/generated/any_l2.c +++ b/libgfortran/generated/any_l2.c @@ -60,25 +60,24 @@ any_l2 (gfc_array_l2 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ any_l2 (gfc_array_l2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ any_l2 (gfc_array_l2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " ANY intrinsic in dimension %d:" @@ -142,7 +140,7 @@ any_l2 (gfc_array_l2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/any_l4.c b/libgfortran/generated/any_l4.c index b157812..8f82741 100644 --- a/libgfortran/generated/any_l4.c +++ b/libgfortran/generated/any_l4.c @@ -60,25 +60,24 @@ any_l4 (gfc_array_l4 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ any_l4 (gfc_array_l4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ any_l4 (gfc_array_l4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " ANY intrinsic in dimension %d:" @@ -142,7 +140,7 @@ any_l4 (gfc_array_l4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/any_l8.c b/libgfortran/generated/any_l8.c index f66b00f..2a094f0 100644 --- a/libgfortran/generated/any_l8.c +++ b/libgfortran/generated/any_l8.c @@ -60,25 +60,24 @@ any_l8 (gfc_array_l8 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ any_l8 (gfc_array_l8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ any_l8 (gfc_array_l8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " ANY intrinsic in dimension %d:" @@ -142,7 +140,7 @@ any_l8 (gfc_array_l8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/count_16_l.c b/libgfortran/generated/count_16_l.c index c0a488e..8c3fc7d 100644 --- a/libgfortran/generated/count_16_l.c +++ b/libgfortran/generated/count_16_l.c @@ -60,25 +60,24 @@ count_16_l (gfc_array_i16 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ count_16_l (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ count_16_l (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " COUNT intrinsic in dimension %d:" @@ -142,7 +140,7 @@ count_16_l (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/count_1_l.c b/libgfortran/generated/count_1_l.c index a236897..faf9176 100644 --- a/libgfortran/generated/count_1_l.c +++ b/libgfortran/generated/count_1_l.c @@ -60,25 +60,24 @@ count_1_l (gfc_array_i1 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ count_1_l (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ count_1_l (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " COUNT intrinsic in dimension %d:" @@ -142,7 +140,7 @@ count_1_l (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/count_2_l.c b/libgfortran/generated/count_2_l.c index 7ae90f2..0d1a223 100644 --- a/libgfortran/generated/count_2_l.c +++ b/libgfortran/generated/count_2_l.c @@ -60,25 +60,24 @@ count_2_l (gfc_array_i2 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ count_2_l (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ count_2_l (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " COUNT intrinsic in dimension %d:" @@ -142,7 +140,7 @@ count_2_l (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/count_4_l.c b/libgfortran/generated/count_4_l.c index 75f0f58..d4bfbd4 100644 --- a/libgfortran/generated/count_4_l.c +++ b/libgfortran/generated/count_4_l.c @@ -60,25 +60,24 @@ count_4_l (gfc_array_i4 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ count_4_l (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ count_4_l (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " COUNT intrinsic in dimension %d:" @@ -142,7 +140,7 @@ count_4_l (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/count_8_l.c b/libgfortran/generated/count_8_l.c index da53d1c..2a62ea8 100644 --- a/libgfortran/generated/count_8_l.c +++ b/libgfortran/generated/count_8_l.c @@ -60,25 +60,24 @@ count_8_l (gfc_array_i8 * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -86,29 +85,29 @@ count_8_l (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -128,8 +127,7 @@ count_8_l (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " COUNT intrinsic in dimension %d:" @@ -142,7 +140,7 @@ count_8_l (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/generated/cshift0_c10.c b/libgfortran/generated/cshift0_c10.c index 1f8078d..16c113d 100644 --- a/libgfortran/generated/cshift0_c10.c +++ b/libgfortran/generated/cshift0_c10.c @@ -69,20 +69,20 @@ cshift0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_c16.c b/libgfortran/generated/cshift0_c16.c index 83afa51..df83ccb 100644 --- a/libgfortran/generated/cshift0_c16.c +++ b/libgfortran/generated/cshift0_c16.c @@ -69,20 +69,20 @@ cshift0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_c4.c b/libgfortran/generated/cshift0_c4.c index 32a6006..52d277f 100644 --- a/libgfortran/generated/cshift0_c4.c +++ b/libgfortran/generated/cshift0_c4.c @@ -69,20 +69,20 @@ cshift0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_c8.c b/libgfortran/generated/cshift0_c8.c index a9d152d..9b9c3b2 100644 --- a/libgfortran/generated/cshift0_c8.c +++ b/libgfortran/generated/cshift0_c8.c @@ -69,20 +69,20 @@ cshift0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_i1.c b/libgfortran/generated/cshift0_i1.c index 539af35..7ed44bd 100644 --- a/libgfortran/generated/cshift0_i1.c +++ b/libgfortran/generated/cshift0_i1.c @@ -69,20 +69,20 @@ cshift0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_i16.c b/libgfortran/generated/cshift0_i16.c index fa48d41..145724b 100644 --- a/libgfortran/generated/cshift0_i16.c +++ b/libgfortran/generated/cshift0_i16.c @@ -69,20 +69,20 @@ cshift0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_i2.c b/libgfortran/generated/cshift0_i2.c index af07c01..df33281 100644 --- a/libgfortran/generated/cshift0_i2.c +++ b/libgfortran/generated/cshift0_i2.c @@ -69,20 +69,20 @@ cshift0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_i4.c b/libgfortran/generated/cshift0_i4.c index 1997b18..a1e1185 100644 --- a/libgfortran/generated/cshift0_i4.c +++ b/libgfortran/generated/cshift0_i4.c @@ -69,20 +69,20 @@ cshift0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_i8.c b/libgfortran/generated/cshift0_i8.c index 6144d61..cbe13f1 100644 --- a/libgfortran/generated/cshift0_i8.c +++ b/libgfortran/generated/cshift0_i8.c @@ -69,20 +69,20 @@ cshift0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_r10.c b/libgfortran/generated/cshift0_r10.c index b3d5f8e..8ba544d 100644 --- a/libgfortran/generated/cshift0_r10.c +++ b/libgfortran/generated/cshift0_r10.c @@ -69,20 +69,20 @@ cshift0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_r16.c b/libgfortran/generated/cshift0_r16.c index 3088da4..0725048 100644 --- a/libgfortran/generated/cshift0_r16.c +++ b/libgfortran/generated/cshift0_r16.c @@ -69,20 +69,20 @@ cshift0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_r4.c b/libgfortran/generated/cshift0_r4.c index 176be1f..515c36b 100644 --- a/libgfortran/generated/cshift0_r4.c +++ b/libgfortran/generated/cshift0_r4.c @@ -69,20 +69,20 @@ cshift0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift0_r8.c b/libgfortran/generated/cshift0_r8.c index 7947ff9..5a721e4 100644 --- a/libgfortran/generated/cshift0_r8.c +++ b/libgfortran/generated/cshift0_r8.c @@ -69,20 +69,20 @@ cshift0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/generated/cshift1_16.c b/libgfortran/generated/cshift1_16.c index 7a7d0db..df97dfa 100644 --- a/libgfortran/generated/cshift1_16.c +++ b/libgfortran/generated/cshift1_16.c @@ -35,8 +35,7 @@ static void cshift1 (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const gfc_array_i16 * const restrict h, - const GFC_INTEGER_16 * const restrict pwhich, - index_type size) + const GFC_INTEGER_16 * const restrict pwhich) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -63,6 +62,7 @@ cshift1 (gfc_array_char * const restrict ret, int which; GFC_INTEGER_16 sh; index_type arraysize; + index_type size; if (pwhich) which = *pwhich - 1; @@ -72,6 +72,8 @@ cshift1 (gfc_array_char * const restrict ret, if (which < 0 || (which + 1) > GFC_DESCRIPTOR_RANK (array)) runtime_error ("Argument 'DIM' is out of range in call to 'CSHIFT'"); + size = GFC_DESCRIPTOR_SIZE(array); + arraysize = size0 ((array_t *)array); if (ret->data == NULL) @@ -83,13 +85,17 @@ cshift1 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) * + GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } } @@ -109,22 +115,22 @@ cshift1 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); n++; } } @@ -210,7 +216,7 @@ cshift1_16 (gfc_array_char * const restrict ret, const gfc_array_i16 * const restrict h, const GFC_INTEGER_16 * const restrict pwhich) { - cshift1 (ret, array, h, pwhich, GFC_DESCRIPTOR_SIZE (array)); + cshift1 (ret, array, h, pwhich); } @@ -228,9 +234,9 @@ cshift1_16_char (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const gfc_array_i16 * const restrict h, const GFC_INTEGER_16 * const restrict pwhich, - GFC_INTEGER_4 array_length) + GFC_INTEGER_4 array_length __attribute__((unused))) { - cshift1 (ret, array, h, pwhich, array_length); + cshift1 (ret, array, h, pwhich); } @@ -248,9 +254,9 @@ cshift1_16_char4 (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const gfc_array_i16 * const restrict h, const GFC_INTEGER_16 * const restrict pwhich, - GFC_INTEGER_4 array_length) + GFC_INTEGER_4 array_length __attribute__((unused))) { - cshift1 (ret, array, h, pwhich, array_length * sizeof (gfc_char4_t)); + cshift1 (ret, array, h, pwhich); } #endif diff --git a/libgfortran/generated/cshift1_4.c b/libgfortran/generated/cshift1_4.c index c6f124f..f048e8e 100644 --- a/libgfortran/generated/cshift1_4.c +++ b/libgfortran/generated/cshift1_4.c @@ -35,8 +35,7 @@ static void cshift1 (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const gfc_array_i4 * const restrict h, - const GFC_INTEGER_4 * const restrict pwhich, - index_type size) + const GFC_INTEGER_4 * const restrict pwhich) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -63,6 +62,7 @@ cshift1 (gfc_array_char * const restrict ret, int which; GFC_INTEGER_4 sh; index_type arraysize; + index_type size; if (pwhich) which = *pwhich - 1; @@ -72,6 +72,8 @@ cshift1 (gfc_array_char * const restrict ret, if (which < 0 || (which + 1) > GFC_DESCRIPTOR_RANK (array)) runtime_error ("Argument 'DIM' is out of range in call to 'CSHIFT'"); + size = GFC_DESCRIPTOR_SIZE(array); + arraysize = size0 ((array_t *)array); if (ret->data == NULL) @@ -83,13 +85,17 @@ cshift1 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) * + GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } } @@ -109,22 +115,22 @@ cshift1 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); n++; } } @@ -210,7 +216,7 @@ cshift1_4 (gfc_array_char * const restrict ret, const gfc_array_i4 * const restrict h, const GFC_INTEGER_4 * const restrict pwhich) { - cshift1 (ret, array, h, pwhich, GFC_DESCRIPTOR_SIZE (array)); + cshift1 (ret, array, h, pwhich); } @@ -228,9 +234,9 @@ cshift1_4_char (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const gfc_array_i4 * const restrict h, const GFC_INTEGER_4 * const restrict pwhich, - GFC_INTEGER_4 array_length) + GFC_INTEGER_4 array_length __attribute__((unused))) { - cshift1 (ret, array, h, pwhich, array_length); + cshift1 (ret, array, h, pwhich); } @@ -248,9 +254,9 @@ cshift1_4_char4 (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const gfc_array_i4 * const restrict h, const GFC_INTEGER_4 * const restrict pwhich, - GFC_INTEGER_4 array_length) + GFC_INTEGER_4 array_length __attribute__((unused))) { - cshift1 (ret, array, h, pwhich, array_length * sizeof (gfc_char4_t)); + cshift1 (ret, array, h, pwhich); } #endif diff --git a/libgfortran/generated/cshift1_8.c b/libgfortran/generated/cshift1_8.c index 54e92db..9667728 100644 --- a/libgfortran/generated/cshift1_8.c +++ b/libgfortran/generated/cshift1_8.c @@ -35,8 +35,7 @@ static void cshift1 (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const gfc_array_i8 * const restrict h, - const GFC_INTEGER_8 * const restrict pwhich, - index_type size) + const GFC_INTEGER_8 * const restrict pwhich) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -63,6 +62,7 @@ cshift1 (gfc_array_char * const restrict ret, int which; GFC_INTEGER_8 sh; index_type arraysize; + index_type size; if (pwhich) which = *pwhich - 1; @@ -72,6 +72,8 @@ cshift1 (gfc_array_char * const restrict ret, if (which < 0 || (which + 1) > GFC_DESCRIPTOR_RANK (array)) runtime_error ("Argument 'DIM' is out of range in call to 'CSHIFT'"); + size = GFC_DESCRIPTOR_SIZE(array); + arraysize = size0 ((array_t *)array); if (ret->data == NULL) @@ -83,13 +85,17 @@ cshift1 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) * + GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } } @@ -109,22 +115,22 @@ cshift1 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); n++; } } @@ -210,7 +216,7 @@ cshift1_8 (gfc_array_char * const restrict ret, const gfc_array_i8 * const restrict h, const GFC_INTEGER_8 * const restrict pwhich) { - cshift1 (ret, array, h, pwhich, GFC_DESCRIPTOR_SIZE (array)); + cshift1 (ret, array, h, pwhich); } @@ -228,9 +234,9 @@ cshift1_8_char (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const gfc_array_i8 * const restrict h, const GFC_INTEGER_8 * const restrict pwhich, - GFC_INTEGER_4 array_length) + GFC_INTEGER_4 array_length __attribute__((unused))) { - cshift1 (ret, array, h, pwhich, array_length); + cshift1 (ret, array, h, pwhich); } @@ -248,9 +254,9 @@ cshift1_8_char4 (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const gfc_array_i8 * const restrict h, const GFC_INTEGER_8 * const restrict pwhich, - GFC_INTEGER_4 array_length) + GFC_INTEGER_4 array_length __attribute__((unused))) { - cshift1 (ret, array, h, pwhich, array_length * sizeof (gfc_char4_t)); + cshift1 (ret, array, h, pwhich); } #endif diff --git a/libgfortran/generated/eoshift1_16.c b/libgfortran/generated/eoshift1_16.c index b9fe9c3..02365cc 100644 --- a/libgfortran/generated/eoshift1_16.c +++ b/libgfortran/generated/eoshift1_16.c @@ -37,7 +37,7 @@ eoshift1 (gfc_array_char * const restrict ret, const gfc_array_i16 * const restrict h, const char * const restrict pbound, const GFC_INTEGER_16 * const restrict pwhich, - index_type size, const char * filler, index_type filler_len) + const char * filler, index_type filler_len) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -61,6 +61,7 @@ eoshift1 (gfc_array_char * const restrict ret, index_type dim; index_type len; index_type n; + index_type size; int which; GFC_INTEGER_16 sh; GFC_INTEGER_16 delta; @@ -71,6 +72,8 @@ eoshift1 (gfc_array_char * const restrict ret, soffset = 0; roffset = 0; + size = GFC_DESCRIPTOR_SIZE(array); + if (pwhich) which = *pwhich - 1; else @@ -88,13 +91,18 @@ eoshift1 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) + * GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + } } else @@ -108,22 +116,22 @@ eoshift1 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); n++; } } @@ -241,8 +249,7 @@ eoshift1_16 (gfc_array_char * const restrict ret, const char * const restrict pbound, const GFC_INTEGER_16 * const restrict pwhich) { - eoshift1 (ret, array, h, pbound, pwhich, GFC_DESCRIPTOR_SIZE (array), - "\0", 1); + eoshift1 (ret, array, h, pbound, pwhich, "\0", 1); } @@ -262,10 +269,10 @@ eoshift1_16_char (gfc_array_char * const restrict ret, const gfc_array_i16 * const restrict h, const char * const restrict pbound, const GFC_INTEGER_16 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { - eoshift1 (ret, array, h, pbound, pwhich, array_length, " ", 1); + eoshift1 (ret, array, h, pbound, pwhich, " ", 1); } @@ -285,11 +292,11 @@ eoshift1_16_char4 (gfc_array_char * const restrict ret, const gfc_array_i16 * const restrict h, const char * const restrict pbound, const GFC_INTEGER_16 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { static const gfc_char4_t space = (unsigned char) ' '; - eoshift1 (ret, array, h, pbound, pwhich, array_length * sizeof (gfc_char4_t), + eoshift1 (ret, array, h, pbound, pwhich, (const char *) &space, sizeof (gfc_char4_t)); } diff --git a/libgfortran/generated/eoshift1_4.c b/libgfortran/generated/eoshift1_4.c index 0510d2c..e703db4 100644 --- a/libgfortran/generated/eoshift1_4.c +++ b/libgfortran/generated/eoshift1_4.c @@ -37,7 +37,7 @@ eoshift1 (gfc_array_char * const restrict ret, const gfc_array_i4 * const restrict h, const char * const restrict pbound, const GFC_INTEGER_4 * const restrict pwhich, - index_type size, const char * filler, index_type filler_len) + const char * filler, index_type filler_len) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -61,6 +61,7 @@ eoshift1 (gfc_array_char * const restrict ret, index_type dim; index_type len; index_type n; + index_type size; int which; GFC_INTEGER_4 sh; GFC_INTEGER_4 delta; @@ -71,6 +72,8 @@ eoshift1 (gfc_array_char * const restrict ret, soffset = 0; roffset = 0; + size = GFC_DESCRIPTOR_SIZE(array); + if (pwhich) which = *pwhich - 1; else @@ -88,13 +91,18 @@ eoshift1 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) + * GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + } } else @@ -108,22 +116,22 @@ eoshift1 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); n++; } } @@ -241,8 +249,7 @@ eoshift1_4 (gfc_array_char * const restrict ret, const char * const restrict pbound, const GFC_INTEGER_4 * const restrict pwhich) { - eoshift1 (ret, array, h, pbound, pwhich, GFC_DESCRIPTOR_SIZE (array), - "\0", 1); + eoshift1 (ret, array, h, pbound, pwhich, "\0", 1); } @@ -262,10 +269,10 @@ eoshift1_4_char (gfc_array_char * const restrict ret, const gfc_array_i4 * const restrict h, const char * const restrict pbound, const GFC_INTEGER_4 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { - eoshift1 (ret, array, h, pbound, pwhich, array_length, " ", 1); + eoshift1 (ret, array, h, pbound, pwhich, " ", 1); } @@ -285,11 +292,11 @@ eoshift1_4_char4 (gfc_array_char * const restrict ret, const gfc_array_i4 * const restrict h, const char * const restrict pbound, const GFC_INTEGER_4 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { static const gfc_char4_t space = (unsigned char) ' '; - eoshift1 (ret, array, h, pbound, pwhich, array_length * sizeof (gfc_char4_t), + eoshift1 (ret, array, h, pbound, pwhich, (const char *) &space, sizeof (gfc_char4_t)); } diff --git a/libgfortran/generated/eoshift1_8.c b/libgfortran/generated/eoshift1_8.c index d61023e5..f8922b3 100644 --- a/libgfortran/generated/eoshift1_8.c +++ b/libgfortran/generated/eoshift1_8.c @@ -37,7 +37,7 @@ eoshift1 (gfc_array_char * const restrict ret, const gfc_array_i8 * const restrict h, const char * const restrict pbound, const GFC_INTEGER_8 * const restrict pwhich, - index_type size, const char * filler, index_type filler_len) + const char * filler, index_type filler_len) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -61,6 +61,7 @@ eoshift1 (gfc_array_char * const restrict ret, index_type dim; index_type len; index_type n; + index_type size; int which; GFC_INTEGER_8 sh; GFC_INTEGER_8 delta; @@ -71,6 +72,8 @@ eoshift1 (gfc_array_char * const restrict ret, soffset = 0; roffset = 0; + size = GFC_DESCRIPTOR_SIZE(array); + if (pwhich) which = *pwhich - 1; else @@ -88,13 +91,18 @@ eoshift1 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) + * GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + } } else @@ -108,22 +116,22 @@ eoshift1 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); n++; } } @@ -241,8 +249,7 @@ eoshift1_8 (gfc_array_char * const restrict ret, const char * const restrict pbound, const GFC_INTEGER_8 * const restrict pwhich) { - eoshift1 (ret, array, h, pbound, pwhich, GFC_DESCRIPTOR_SIZE (array), - "\0", 1); + eoshift1 (ret, array, h, pbound, pwhich, "\0", 1); } @@ -262,10 +269,10 @@ eoshift1_8_char (gfc_array_char * const restrict ret, const gfc_array_i8 * const restrict h, const char * const restrict pbound, const GFC_INTEGER_8 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { - eoshift1 (ret, array, h, pbound, pwhich, array_length, " ", 1); + eoshift1 (ret, array, h, pbound, pwhich, " ", 1); } @@ -285,11 +292,11 @@ eoshift1_8_char4 (gfc_array_char * const restrict ret, const gfc_array_i8 * const restrict h, const char * const restrict pbound, const GFC_INTEGER_8 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { static const gfc_char4_t space = (unsigned char) ' '; - eoshift1 (ret, array, h, pbound, pwhich, array_length * sizeof (gfc_char4_t), + eoshift1 (ret, array, h, pbound, pwhich, (const char *) &space, sizeof (gfc_char4_t)); } diff --git a/libgfortran/generated/eoshift3_16.c b/libgfortran/generated/eoshift3_16.c index 282409e..c3efae9 100644 --- a/libgfortran/generated/eoshift3_16.c +++ b/libgfortran/generated/eoshift3_16.c @@ -37,7 +37,7 @@ eoshift3 (gfc_array_char * const restrict ret, const gfc_array_i16 * const restrict h, const gfc_array_char * const restrict bound, const GFC_INTEGER_16 * const restrict pwhich, - index_type size, const char * filler, index_type filler_len) + const char * filler, index_type filler_len) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -65,6 +65,7 @@ eoshift3 (gfc_array_char * const restrict ret, index_type dim; index_type len; index_type n; + index_type size; int which; GFC_INTEGER_16 sh; GFC_INTEGER_16 delta; @@ -75,6 +76,8 @@ eoshift3 (gfc_array_char * const restrict ret, soffset = 0; roffset = 0; + size = GFC_DESCRIPTOR_SIZE(array); + if (pwhich) which = *pwhich - 1; else @@ -89,13 +92,18 @@ eoshift3 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) + * GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + } } else @@ -112,24 +120,24 @@ eoshift3 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); if (bound) - bstride[n] = bound->dim[n].stride * size; + bstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(bound,n); else bstride[n] = 0; n++; @@ -260,8 +268,7 @@ eoshift3_16 (gfc_array_char * const restrict ret, const gfc_array_char * const restrict bound, const GFC_INTEGER_16 * const restrict pwhich) { - eoshift3 (ret, array, h, bound, pwhich, GFC_DESCRIPTOR_SIZE (array), - "\0", 1); + eoshift3 (ret, array, h, bound, pwhich, "\0", 1); } @@ -281,10 +288,10 @@ eoshift3_16_char (gfc_array_char * const restrict ret, const gfc_array_i16 * const restrict h, const gfc_array_char * const restrict bound, const GFC_INTEGER_16 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { - eoshift3 (ret, array, h, bound, pwhich, array_length, " ", 1); + eoshift3 (ret, array, h, bound, pwhich, " ", 1); } @@ -304,11 +311,11 @@ eoshift3_16_char4 (gfc_array_char * const restrict ret, const gfc_array_i16 * const restrict h, const gfc_array_char * const restrict bound, const GFC_INTEGER_16 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { static const gfc_char4_t space = (unsigned char) ' '; - eoshift3 (ret, array, h, bound, pwhich, array_length * sizeof (gfc_char4_t), + eoshift3 (ret, array, h, bound, pwhich, (const char *) &space, sizeof (gfc_char4_t)); } diff --git a/libgfortran/generated/eoshift3_4.c b/libgfortran/generated/eoshift3_4.c index a165945..5038c09 100644 --- a/libgfortran/generated/eoshift3_4.c +++ b/libgfortran/generated/eoshift3_4.c @@ -37,7 +37,7 @@ eoshift3 (gfc_array_char * const restrict ret, const gfc_array_i4 * const restrict h, const gfc_array_char * const restrict bound, const GFC_INTEGER_4 * const restrict pwhich, - index_type size, const char * filler, index_type filler_len) + const char * filler, index_type filler_len) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -65,6 +65,7 @@ eoshift3 (gfc_array_char * const restrict ret, index_type dim; index_type len; index_type n; + index_type size; int which; GFC_INTEGER_4 sh; GFC_INTEGER_4 delta; @@ -75,6 +76,8 @@ eoshift3 (gfc_array_char * const restrict ret, soffset = 0; roffset = 0; + size = GFC_DESCRIPTOR_SIZE(array); + if (pwhich) which = *pwhich - 1; else @@ -89,13 +92,18 @@ eoshift3 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) + * GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + } } else @@ -112,24 +120,24 @@ eoshift3 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); if (bound) - bstride[n] = bound->dim[n].stride * size; + bstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(bound,n); else bstride[n] = 0; n++; @@ -260,8 +268,7 @@ eoshift3_4 (gfc_array_char * const restrict ret, const gfc_array_char * const restrict bound, const GFC_INTEGER_4 * const restrict pwhich) { - eoshift3 (ret, array, h, bound, pwhich, GFC_DESCRIPTOR_SIZE (array), - "\0", 1); + eoshift3 (ret, array, h, bound, pwhich, "\0", 1); } @@ -281,10 +288,10 @@ eoshift3_4_char (gfc_array_char * const restrict ret, const gfc_array_i4 * const restrict h, const gfc_array_char * const restrict bound, const GFC_INTEGER_4 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { - eoshift3 (ret, array, h, bound, pwhich, array_length, " ", 1); + eoshift3 (ret, array, h, bound, pwhich, " ", 1); } @@ -304,11 +311,11 @@ eoshift3_4_char4 (gfc_array_char * const restrict ret, const gfc_array_i4 * const restrict h, const gfc_array_char * const restrict bound, const GFC_INTEGER_4 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { static const gfc_char4_t space = (unsigned char) ' '; - eoshift3 (ret, array, h, bound, pwhich, array_length * sizeof (gfc_char4_t), + eoshift3 (ret, array, h, bound, pwhich, (const char *) &space, sizeof (gfc_char4_t)); } diff --git a/libgfortran/generated/eoshift3_8.c b/libgfortran/generated/eoshift3_8.c index 5942de5..f745a1d 100644 --- a/libgfortran/generated/eoshift3_8.c +++ b/libgfortran/generated/eoshift3_8.c @@ -37,7 +37,7 @@ eoshift3 (gfc_array_char * const restrict ret, const gfc_array_i8 * const restrict h, const gfc_array_char * const restrict bound, const GFC_INTEGER_8 * const restrict pwhich, - index_type size, const char * filler, index_type filler_len) + const char * filler, index_type filler_len) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -65,6 +65,7 @@ eoshift3 (gfc_array_char * const restrict ret, index_type dim; index_type len; index_type n; + index_type size; int which; GFC_INTEGER_8 sh; GFC_INTEGER_8 delta; @@ -75,6 +76,8 @@ eoshift3 (gfc_array_char * const restrict ret, soffset = 0; roffset = 0; + size = GFC_DESCRIPTOR_SIZE(array); + if (pwhich) which = *pwhich - 1; else @@ -89,13 +92,18 @@ eoshift3 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) + * GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + } } else @@ -112,24 +120,24 @@ eoshift3 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); if (bound) - bstride[n] = bound->dim[n].stride * size; + bstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(bound,n); else bstride[n] = 0; n++; @@ -260,8 +268,7 @@ eoshift3_8 (gfc_array_char * const restrict ret, const gfc_array_char * const restrict bound, const GFC_INTEGER_8 * const restrict pwhich) { - eoshift3 (ret, array, h, bound, pwhich, GFC_DESCRIPTOR_SIZE (array), - "\0", 1); + eoshift3 (ret, array, h, bound, pwhich, "\0", 1); } @@ -281,10 +288,10 @@ eoshift3_8_char (gfc_array_char * const restrict ret, const gfc_array_i8 * const restrict h, const gfc_array_char * const restrict bound, const GFC_INTEGER_8 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { - eoshift3 (ret, array, h, bound, pwhich, array_length, " ", 1); + eoshift3 (ret, array, h, bound, pwhich, " ", 1); } @@ -304,11 +311,11 @@ eoshift3_8_char4 (gfc_array_char * const restrict ret, const gfc_array_i8 * const restrict h, const gfc_array_char * const restrict bound, const GFC_INTEGER_8 * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { static const gfc_char4_t space = (unsigned char) ' '; - eoshift3 (ret, array, h, bound, pwhich, array_length * sizeof (gfc_char4_t), + eoshift3 (ret, array, h, bound, pwhich, (const char *) &space, sizeof (gfc_char4_t)); } diff --git a/libgfortran/generated/in_pack_c10.c b/libgfortran/generated/in_pack_c10.c index afe5ba1..97ce9d1 100644 --- a/libgfortran/generated/in_pack_c10.c +++ b/libgfortran/generated/in_pack_c10.c @@ -57,8 +57,8 @@ internal_pack_c10 (gfc_array_c10 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_c16.c b/libgfortran/generated/in_pack_c16.c index c60c687..74e3cb6 100644 --- a/libgfortran/generated/in_pack_c16.c +++ b/libgfortran/generated/in_pack_c16.c @@ -57,8 +57,8 @@ internal_pack_c16 (gfc_array_c16 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_c4.c b/libgfortran/generated/in_pack_c4.c index a117f7a..ae52bc6 100644 --- a/libgfortran/generated/in_pack_c4.c +++ b/libgfortran/generated/in_pack_c4.c @@ -57,8 +57,8 @@ internal_pack_c4 (gfc_array_c4 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_c8.c b/libgfortran/generated/in_pack_c8.c index f57f2aa..142ad99 100644 --- a/libgfortran/generated/in_pack_c8.c +++ b/libgfortran/generated/in_pack_c8.c @@ -57,8 +57,8 @@ internal_pack_c8 (gfc_array_c8 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_i1.c b/libgfortran/generated/in_pack_i1.c index 1378f89..dc26c1a 100644 --- a/libgfortran/generated/in_pack_i1.c +++ b/libgfortran/generated/in_pack_i1.c @@ -57,8 +57,8 @@ internal_pack_1 (gfc_array_i1 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_i16.c b/libgfortran/generated/in_pack_i16.c index eced924..32ce3a4 100644 --- a/libgfortran/generated/in_pack_i16.c +++ b/libgfortran/generated/in_pack_i16.c @@ -57,8 +57,8 @@ internal_pack_16 (gfc_array_i16 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_i2.c b/libgfortran/generated/in_pack_i2.c index 5cb89fc..3c39f8e 100644 --- a/libgfortran/generated/in_pack_i2.c +++ b/libgfortran/generated/in_pack_i2.c @@ -57,8 +57,8 @@ internal_pack_2 (gfc_array_i2 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_i4.c b/libgfortran/generated/in_pack_i4.c index 7b97b20..4cd7dba 100644 --- a/libgfortran/generated/in_pack_i4.c +++ b/libgfortran/generated/in_pack_i4.c @@ -57,8 +57,8 @@ internal_pack_4 (gfc_array_i4 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_i8.c b/libgfortran/generated/in_pack_i8.c index 2a8f6d7..17acc68 100644 --- a/libgfortran/generated/in_pack_i8.c +++ b/libgfortran/generated/in_pack_i8.c @@ -57,8 +57,8 @@ internal_pack_8 (gfc_array_i8 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_r10.c b/libgfortran/generated/in_pack_r10.c index 1f283f3..557ccc2 100644 --- a/libgfortran/generated/in_pack_r10.c +++ b/libgfortran/generated/in_pack_r10.c @@ -57,8 +57,8 @@ internal_pack_r10 (gfc_array_r10 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_r16.c b/libgfortran/generated/in_pack_r16.c index 6c7c79e..b737cc7 100644 --- a/libgfortran/generated/in_pack_r16.c +++ b/libgfortran/generated/in_pack_r16.c @@ -57,8 +57,8 @@ internal_pack_r16 (gfc_array_r16 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_r4.c b/libgfortran/generated/in_pack_r4.c index 372f087..68a7e5a 100644 --- a/libgfortran/generated/in_pack_r4.c +++ b/libgfortran/generated/in_pack_r4.c @@ -57,8 +57,8 @@ internal_pack_r4 (gfc_array_r4 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_pack_r8.c b/libgfortran/generated/in_pack_r8.c index 09a2544..1453f86 100644 --- a/libgfortran/generated/in_pack_r8.c +++ b/libgfortran/generated/in_pack_r8.c @@ -57,8 +57,8 @@ internal_pack_r8 (gfc_array_r8 * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/generated/in_unpack_c10.c b/libgfortran/generated/in_unpack_c10.c index 46ce8d4..bcac6e7 100644 --- a/libgfortran/generated/in_unpack_c10.c +++ b/libgfortran/generated/in_unpack_c10.c @@ -52,8 +52,8 @@ internal_unpack_c10 (gfc_array_c10 * d, const GFC_COMPLEX_10 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_c16.c b/libgfortran/generated/in_unpack_c16.c index 1b783bd..1d09a80 100644 --- a/libgfortran/generated/in_unpack_c16.c +++ b/libgfortran/generated/in_unpack_c16.c @@ -52,8 +52,8 @@ internal_unpack_c16 (gfc_array_c16 * d, const GFC_COMPLEX_16 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_c4.c b/libgfortran/generated/in_unpack_c4.c index fcf2abb..9ad8a33 100644 --- a/libgfortran/generated/in_unpack_c4.c +++ b/libgfortran/generated/in_unpack_c4.c @@ -52,8 +52,8 @@ internal_unpack_c4 (gfc_array_c4 * d, const GFC_COMPLEX_4 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_c8.c b/libgfortran/generated/in_unpack_c8.c index 994b234..6adae64 100644 --- a/libgfortran/generated/in_unpack_c8.c +++ b/libgfortran/generated/in_unpack_c8.c @@ -52,8 +52,8 @@ internal_unpack_c8 (gfc_array_c8 * d, const GFC_COMPLEX_8 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_i1.c b/libgfortran/generated/in_unpack_i1.c index 323b684..e632816 100644 --- a/libgfortran/generated/in_unpack_i1.c +++ b/libgfortran/generated/in_unpack_i1.c @@ -52,8 +52,8 @@ internal_unpack_1 (gfc_array_i1 * d, const GFC_INTEGER_1 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_i16.c b/libgfortran/generated/in_unpack_i16.c index 04b2248..c719920 100644 --- a/libgfortran/generated/in_unpack_i16.c +++ b/libgfortran/generated/in_unpack_i16.c @@ -52,8 +52,8 @@ internal_unpack_16 (gfc_array_i16 * d, const GFC_INTEGER_16 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_i2.c b/libgfortran/generated/in_unpack_i2.c index cdcd9ea..ec0c1c3 100644 --- a/libgfortran/generated/in_unpack_i2.c +++ b/libgfortran/generated/in_unpack_i2.c @@ -52,8 +52,8 @@ internal_unpack_2 (gfc_array_i2 * d, const GFC_INTEGER_2 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_i4.c b/libgfortran/generated/in_unpack_i4.c index 837e35c..ce5d29d 100644 --- a/libgfortran/generated/in_unpack_i4.c +++ b/libgfortran/generated/in_unpack_i4.c @@ -52,8 +52,8 @@ internal_unpack_4 (gfc_array_i4 * d, const GFC_INTEGER_4 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_i8.c b/libgfortran/generated/in_unpack_i8.c index 7ea8b94..347f011 100644 --- a/libgfortran/generated/in_unpack_i8.c +++ b/libgfortran/generated/in_unpack_i8.c @@ -52,8 +52,8 @@ internal_unpack_8 (gfc_array_i8 * d, const GFC_INTEGER_8 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_r10.c b/libgfortran/generated/in_unpack_r10.c index 15c46b2..aa5f08e 100644 --- a/libgfortran/generated/in_unpack_r10.c +++ b/libgfortran/generated/in_unpack_r10.c @@ -52,8 +52,8 @@ internal_unpack_r10 (gfc_array_r10 * d, const GFC_REAL_10 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_r16.c b/libgfortran/generated/in_unpack_r16.c index af61dfe..0b08228 100644 --- a/libgfortran/generated/in_unpack_r16.c +++ b/libgfortran/generated/in_unpack_r16.c @@ -52,8 +52,8 @@ internal_unpack_r16 (gfc_array_r16 * d, const GFC_REAL_16 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_r4.c b/libgfortran/generated/in_unpack_r4.c index abf8aea..f436c8a 100644 --- a/libgfortran/generated/in_unpack_r4.c +++ b/libgfortran/generated/in_unpack_r4.c @@ -52,8 +52,8 @@ internal_unpack_r4 (gfc_array_r4 * d, const GFC_REAL_4 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/in_unpack_r8.c b/libgfortran/generated/in_unpack_r8.c index bba3fc6..76aff2e 100644 --- a/libgfortran/generated/in_unpack_r8.c +++ b/libgfortran/generated/in_unpack_r8.c @@ -52,8 +52,8 @@ internal_unpack_r8 (gfc_array_r8 * d, const GFC_REAL_8 * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c index 7d4e470..c54c78e 100644 --- a/libgfortran/generated/matmul_c10.c +++ b/libgfortran/generated/matmul_c10.c @@ -105,25 +105,22 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c index 4665bcc..880c0e1 100644 --- a/libgfortran/generated/matmul_c16.c +++ b/libgfortran/generated/matmul_c16.c @@ -105,25 +105,22 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c index 6c7c723..020033a 100644 --- a/libgfortran/generated/matmul_c4.c +++ b/libgfortran/generated/matmul_c4.c @@ -105,25 +105,22 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c index cf1142b..1522dcd 100644 --- a/libgfortran/generated/matmul_c8.c +++ b/libgfortran/generated/matmul_c8.c @@ -105,25 +105,22 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_i1.c b/libgfortran/generated/matmul_i1.c index 502676a..db56678 100644 --- a/libgfortran/generated/matmul_i1.c +++ b/libgfortran/generated/matmul_i1.c @@ -105,25 +105,22 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c index 5b2b05a..f607e27 100644 --- a/libgfortran/generated/matmul_i16.c +++ b/libgfortran/generated/matmul_i16.c @@ -105,25 +105,22 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_i2.c b/libgfortran/generated/matmul_i2.c index bf04fce..58e340b 100644 --- a/libgfortran/generated/matmul_i2.c +++ b/libgfortran/generated/matmul_i2.c @@ -105,25 +105,22 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c index 7b3ba68..46ed493 100644 --- a/libgfortran/generated/matmul_i4.c +++ b/libgfortran/generated/matmul_i4.c @@ -105,25 +105,22 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c index 45b99c3..54ffe62 100644 --- a/libgfortran/generated/matmul_i8.c +++ b/libgfortran/generated/matmul_i8.c @@ -105,25 +105,22 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_l16.c b/libgfortran/generated/matmul_l16.c index fc8e548..5fbeeb7 100644 --- a/libgfortran/generated/matmul_l16.c +++ b/libgfortran/generated/matmul_l16.c @@ -69,25 +69,22 @@ matmul_l16 (gfc_array_l16 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; - - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); + + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -100,8 +97,8 @@ matmul_l16 (gfc_array_l16 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -109,8 +106,8 @@ matmul_l16 (gfc_array_l16 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -118,16 +115,16 @@ matmul_l16 (gfc_array_l16 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -165,46 +162,46 @@ matmul_l16 (gfc_array_l16 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (retarray) == 1) { - rxstride = retarray->dim[0].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); rystride = rxstride; } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } /* If we have rank 1 parameters, zero the absent stride, and set the size to one. */ if (GFC_DESCRIPTOR_RANK (a) == 1) { - astride = a->dim[0].stride * a_kind; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + astride = GFC_DESCRIPTOR_STRIDE_BYTES(a,0); + count = GFC_DESCRIPTOR_EXTENT(a,0); xstride = 0; rxstride = 0; xcount = 1; } else { - astride = a->dim[1].stride * a_kind; - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xstride = a->dim[0].stride * a_kind; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + astride = GFC_DESCRIPTOR_STRIDE_BYTES(a,1); + count = GFC_DESCRIPTOR_EXTENT(a,1); + xstride = GFC_DESCRIPTOR_STRIDE_BYTES(a,0); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } if (GFC_DESCRIPTOR_RANK (b) == 1) { - bstride = b->dim[0].stride * b_kind; - assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound); + bstride = GFC_DESCRIPTOR_STRIDE_BYTES(b,0); + assert(count == GFC_DESCRIPTOR_EXTENT(b,0)); ystride = 0; rystride = 0; ycount = 1; } else { - bstride = b->dim[0].stride * b_kind; - assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound); - ystride = b->dim[1].stride * b_kind; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bstride = GFC_DESCRIPTOR_STRIDE_BYTES(b,0); + assert(count == GFC_DESCRIPTOR_EXTENT(b,0)); + ystride = GFC_DESCRIPTOR_STRIDE_BYTES(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } for (y = 0; y < ycount; y++) diff --git a/libgfortran/generated/matmul_l4.c b/libgfortran/generated/matmul_l4.c index c7bb584..19ca9f1 100644 --- a/libgfortran/generated/matmul_l4.c +++ b/libgfortran/generated/matmul_l4.c @@ -69,25 +69,22 @@ matmul_l4 (gfc_array_l4 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; - - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); + + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -100,8 +97,8 @@ matmul_l4 (gfc_array_l4 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -109,8 +106,8 @@ matmul_l4 (gfc_array_l4 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -118,16 +115,16 @@ matmul_l4 (gfc_array_l4 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -165,46 +162,46 @@ matmul_l4 (gfc_array_l4 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (retarray) == 1) { - rxstride = retarray->dim[0].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); rystride = rxstride; } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } /* If we have rank 1 parameters, zero the absent stride, and set the size to one. */ if (GFC_DESCRIPTOR_RANK (a) == 1) { - astride = a->dim[0].stride * a_kind; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + astride = GFC_DESCRIPTOR_STRIDE_BYTES(a,0); + count = GFC_DESCRIPTOR_EXTENT(a,0); xstride = 0; rxstride = 0; xcount = 1; } else { - astride = a->dim[1].stride * a_kind; - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xstride = a->dim[0].stride * a_kind; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + astride = GFC_DESCRIPTOR_STRIDE_BYTES(a,1); + count = GFC_DESCRIPTOR_EXTENT(a,1); + xstride = GFC_DESCRIPTOR_STRIDE_BYTES(a,0); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } if (GFC_DESCRIPTOR_RANK (b) == 1) { - bstride = b->dim[0].stride * b_kind; - assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound); + bstride = GFC_DESCRIPTOR_STRIDE_BYTES(b,0); + assert(count == GFC_DESCRIPTOR_EXTENT(b,0)); ystride = 0; rystride = 0; ycount = 1; } else { - bstride = b->dim[0].stride * b_kind; - assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound); - ystride = b->dim[1].stride * b_kind; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bstride = GFC_DESCRIPTOR_STRIDE_BYTES(b,0); + assert(count == GFC_DESCRIPTOR_EXTENT(b,0)); + ystride = GFC_DESCRIPTOR_STRIDE_BYTES(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } for (y = 0; y < ycount; y++) diff --git a/libgfortran/generated/matmul_l8.c b/libgfortran/generated/matmul_l8.c index 1d15410..558ed25 100644 --- a/libgfortran/generated/matmul_l8.c +++ b/libgfortran/generated/matmul_l8.c @@ -69,25 +69,22 @@ matmul_l8 (gfc_array_l8 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; - - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); + + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -100,8 +97,8 @@ matmul_l8 (gfc_array_l8 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -109,8 +106,8 @@ matmul_l8 (gfc_array_l8 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -118,16 +115,16 @@ matmul_l8 (gfc_array_l8 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -165,46 +162,46 @@ matmul_l8 (gfc_array_l8 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (retarray) == 1) { - rxstride = retarray->dim[0].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); rystride = rxstride; } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } /* If we have rank 1 parameters, zero the absent stride, and set the size to one. */ if (GFC_DESCRIPTOR_RANK (a) == 1) { - astride = a->dim[0].stride * a_kind; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + astride = GFC_DESCRIPTOR_STRIDE_BYTES(a,0); + count = GFC_DESCRIPTOR_EXTENT(a,0); xstride = 0; rxstride = 0; xcount = 1; } else { - astride = a->dim[1].stride * a_kind; - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xstride = a->dim[0].stride * a_kind; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + astride = GFC_DESCRIPTOR_STRIDE_BYTES(a,1); + count = GFC_DESCRIPTOR_EXTENT(a,1); + xstride = GFC_DESCRIPTOR_STRIDE_BYTES(a,0); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } if (GFC_DESCRIPTOR_RANK (b) == 1) { - bstride = b->dim[0].stride * b_kind; - assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound); + bstride = GFC_DESCRIPTOR_STRIDE_BYTES(b,0); + assert(count == GFC_DESCRIPTOR_EXTENT(b,0)); ystride = 0; rystride = 0; ycount = 1; } else { - bstride = b->dim[0].stride * b_kind; - assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound); - ystride = b->dim[1].stride * b_kind; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bstride = GFC_DESCRIPTOR_STRIDE_BYTES(b,0); + assert(count == GFC_DESCRIPTOR_EXTENT(b,0)); + ystride = GFC_DESCRIPTOR_STRIDE_BYTES(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } for (y = 0; y < ycount; y++) diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c index 90338ac..8e32554 100644 --- a/libgfortran/generated/matmul_r10.c +++ b/libgfortran/generated/matmul_r10.c @@ -105,25 +105,22 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c index a8422b3..c115531 100644 --- a/libgfortran/generated/matmul_r16.c +++ b/libgfortran/generated/matmul_r16.c @@ -105,25 +105,22 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c index 0bb5035..5420872 100644 --- a/libgfortran/generated/matmul_r4.c +++ b/libgfortran/generated/matmul_r4.c @@ -105,25 +105,22 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c index 0a07243..72ad1fd 100644 --- a/libgfortran/generated/matmul_r8.c +++ b/libgfortran/generated/matmul_r8.c @@ -105,25 +105,22 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -136,8 +133,8 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -145,8 +142,8 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -154,16 +151,16 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -178,43 +175,43 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -224,9 +221,9 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/generated/maxloc0_16_i1.c b/libgfortran/generated/maxloc0_16_i1.c index b5efced..b43f083 100644 --- a/libgfortran/generated/maxloc0_16_i1.c +++ b/libgfortran/generated/maxloc0_16_i1.c @@ -55,9 +55,7 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ smaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_16_i16.c b/libgfortran/generated/maxloc0_16_i16.c index 6178132..26941a7 100644 --- a/libgfortran/generated/maxloc0_16_i16.c +++ b/libgfortran/generated/maxloc0_16_i16.c @@ -55,9 +55,7 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ smaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_16_i2.c b/libgfortran/generated/maxloc0_16_i2.c index c7489a0..e1d329c 100644 --- a/libgfortran/generated/maxloc0_16_i2.c +++ b/libgfortran/generated/maxloc0_16_i2.c @@ -55,9 +55,7 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ smaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_16_i4.c b/libgfortran/generated/maxloc0_16_i4.c index 17e93bd..4d1d0a1 100644 --- a/libgfortran/generated/maxloc0_16_i4.c +++ b/libgfortran/generated/maxloc0_16_i4.c @@ -55,9 +55,7 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ smaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_16_i8.c b/libgfortran/generated/maxloc0_16_i8.c index 6863d6f..12147a0 100644 --- a/libgfortran/generated/maxloc0_16_i8.c +++ b/libgfortran/generated/maxloc0_16_i8.c @@ -55,9 +55,7 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ smaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_16_r10.c b/libgfortran/generated/maxloc0_16_r10.c index 153fc2b..33c7308 100644 --- a/libgfortran/generated/maxloc0_16_r10.c +++ b/libgfortran/generated/maxloc0_16_r10.c @@ -55,9 +55,7 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ smaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_16_r16.c b/libgfortran/generated/maxloc0_16_r16.c index 1596cdc..4f4f290 100644 --- a/libgfortran/generated/maxloc0_16_r16.c +++ b/libgfortran/generated/maxloc0_16_r16.c @@ -55,9 +55,7 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ smaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_16_r4.c b/libgfortran/generated/maxloc0_16_r4.c index a5e33aa..86cedb3 100644 --- a/libgfortran/generated/maxloc0_16_r4.c +++ b/libgfortran/generated/maxloc0_16_r4.c @@ -55,9 +55,7 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ smaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_16_r8.c b/libgfortran/generated/maxloc0_16_r8.c index 6d645d0..378024b 100644 --- a/libgfortran/generated/maxloc0_16_r8.c +++ b/libgfortran/generated/maxloc0_16_r8.c @@ -55,9 +55,7 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ smaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_4_i1.c b/libgfortran/generated/maxloc0_4_i1.c index e219c9f..7475059 100644 --- a/libgfortran/generated/maxloc0_4_i1.c +++ b/libgfortran/generated/maxloc0_4_i1.c @@ -55,9 +55,7 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ smaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_4_i16.c b/libgfortran/generated/maxloc0_4_i16.c index da1f6ea..268f09a 100644 --- a/libgfortran/generated/maxloc0_4_i16.c +++ b/libgfortran/generated/maxloc0_4_i16.c @@ -55,9 +55,7 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ smaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_4_i2.c b/libgfortran/generated/maxloc0_4_i2.c index c20b306..47fb135 100644 --- a/libgfortran/generated/maxloc0_4_i2.c +++ b/libgfortran/generated/maxloc0_4_i2.c @@ -55,9 +55,7 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ smaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_4_i4.c b/libgfortran/generated/maxloc0_4_i4.c index 2c08c7d5..55bc275 100644 --- a/libgfortran/generated/maxloc0_4_i4.c +++ b/libgfortran/generated/maxloc0_4_i4.c @@ -55,9 +55,7 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ smaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_4_i8.c b/libgfortran/generated/maxloc0_4_i8.c index 1a43838..f598f05 100644 --- a/libgfortran/generated/maxloc0_4_i8.c +++ b/libgfortran/generated/maxloc0_4_i8.c @@ -55,9 +55,7 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ smaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_4_r10.c b/libgfortran/generated/maxloc0_4_r10.c index ca041d6..5c99198 100644 --- a/libgfortran/generated/maxloc0_4_r10.c +++ b/libgfortran/generated/maxloc0_4_r10.c @@ -55,9 +55,7 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ smaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_4_r16.c b/libgfortran/generated/maxloc0_4_r16.c index dba5031..c7609c3 100644 --- a/libgfortran/generated/maxloc0_4_r16.c +++ b/libgfortran/generated/maxloc0_4_r16.c @@ -55,9 +55,7 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ smaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_4_r4.c b/libgfortran/generated/maxloc0_4_r4.c index fe4b140..50f3c3b 100644 --- a/libgfortran/generated/maxloc0_4_r4.c +++ b/libgfortran/generated/maxloc0_4_r4.c @@ -55,9 +55,7 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ smaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_4_r8.c b/libgfortran/generated/maxloc0_4_r8.c index 5360b2f..30dc297 100644 --- a/libgfortran/generated/maxloc0_4_r8.c +++ b/libgfortran/generated/maxloc0_4_r8.c @@ -55,9 +55,7 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ smaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_8_i1.c b/libgfortran/generated/maxloc0_8_i1.c index 061a8a6..eb1737d 100644 --- a/libgfortran/generated/maxloc0_8_i1.c +++ b/libgfortran/generated/maxloc0_8_i1.c @@ -55,9 +55,7 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ smaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_8_i16.c b/libgfortran/generated/maxloc0_8_i16.c index 6ef795d0..6690c2d 100644 --- a/libgfortran/generated/maxloc0_8_i16.c +++ b/libgfortran/generated/maxloc0_8_i16.c @@ -55,9 +55,7 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ smaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_8_i2.c b/libgfortran/generated/maxloc0_8_i2.c index 2c8a376..b9bb230 100644 --- a/libgfortran/generated/maxloc0_8_i2.c +++ b/libgfortran/generated/maxloc0_8_i2.c @@ -55,9 +55,7 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ smaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_8_i4.c b/libgfortran/generated/maxloc0_8_i4.c index d602bb4..5778146 100644 --- a/libgfortran/generated/maxloc0_8_i4.c +++ b/libgfortran/generated/maxloc0_8_i4.c @@ -55,9 +55,7 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ smaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_8_i8.c b/libgfortran/generated/maxloc0_8_i8.c index a4d250c..ef7dede 100644 --- a/libgfortran/generated/maxloc0_8_i8.c +++ b/libgfortran/generated/maxloc0_8_i8.c @@ -55,9 +55,7 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ smaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_8_r10.c b/libgfortran/generated/maxloc0_8_r10.c index 01ffc9d..0c08d8e 100644 --- a/libgfortran/generated/maxloc0_8_r10.c +++ b/libgfortran/generated/maxloc0_8_r10.c @@ -55,9 +55,7 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ smaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_8_r16.c b/libgfortran/generated/maxloc0_8_r16.c index 448cd30..da61d2b 100644 --- a/libgfortran/generated/maxloc0_8_r16.c +++ b/libgfortran/generated/maxloc0_8_r16.c @@ -55,9 +55,7 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ smaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_8_r4.c b/libgfortran/generated/maxloc0_8_r4.c index 971e278..a26b110 100644 --- a/libgfortran/generated/maxloc0_8_r4.c +++ b/libgfortran/generated/maxloc0_8_r4.c @@ -55,9 +55,7 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ smaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc0_8_r8.c b/libgfortran/generated/maxloc0_8_r8.c index 160f774..1198d62 100644 --- a/libgfortran/generated/maxloc0_8_r8.c +++ b/libgfortran/generated/maxloc0_8_r8.c @@ -55,9 +55,7 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MAXLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ smaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ smaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MAXLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/maxloc1_16_i1.c b/libgfortran/generated/maxloc1_16_i1.c index 9e1c268..a776f4f 100644 --- a/libgfortran/generated/maxloc1_16_i1.c +++ b/libgfortran/generated/maxloc1_16_i1.c @@ -58,24 +58,23 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_16_i16.c b/libgfortran/generated/maxloc1_16_i16.c index 3a0a343..827b3e6 100644 --- a/libgfortran/generated/maxloc1_16_i16.c +++ b/libgfortran/generated/maxloc1_16_i16.c @@ -58,24 +58,23 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_16_i2.c b/libgfortran/generated/maxloc1_16_i2.c index 4d87d8e..24a34e3 100644 --- a/libgfortran/generated/maxloc1_16_i2.c +++ b/libgfortran/generated/maxloc1_16_i2.c @@ -58,24 +58,23 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_16_i4.c b/libgfortran/generated/maxloc1_16_i4.c index d1ae2f0..0194f28 100644 --- a/libgfortran/generated/maxloc1_16_i4.c +++ b/libgfortran/generated/maxloc1_16_i4.c @@ -58,24 +58,23 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_16_i8.c b/libgfortran/generated/maxloc1_16_i8.c index 1d60d10..bb17500 100644 --- a/libgfortran/generated/maxloc1_16_i8.c +++ b/libgfortran/generated/maxloc1_16_i8.c @@ -58,24 +58,23 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_16_r10.c b/libgfortran/generated/maxloc1_16_r10.c index e059971..dc8cd5d 100644 --- a/libgfortran/generated/maxloc1_16_r10.c +++ b/libgfortran/generated/maxloc1_16_r10.c @@ -58,24 +58,23 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_16_r16.c b/libgfortran/generated/maxloc1_16_r16.c index 3381560..1664edb 100644 --- a/libgfortran/generated/maxloc1_16_r16.c +++ b/libgfortran/generated/maxloc1_16_r16.c @@ -58,24 +58,23 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_16_r4.c b/libgfortran/generated/maxloc1_16_r4.c index 2defdd1..58bfcc0 100644 --- a/libgfortran/generated/maxloc1_16_r4.c +++ b/libgfortran/generated/maxloc1_16_r4.c @@ -58,24 +58,23 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_16_r8.c b/libgfortran/generated/maxloc1_16_r8.c index a329316..d646d25 100644 --- a/libgfortran/generated/maxloc1_16_r8.c +++ b/libgfortran/generated/maxloc1_16_r8.c @@ -58,24 +58,23 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_4_i1.c b/libgfortran/generated/maxloc1_4_i1.c index 4281921..39291ff 100644 --- a/libgfortran/generated/maxloc1_4_i1.c +++ b/libgfortran/generated/maxloc1_4_i1.c @@ -58,24 +58,23 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_4_i16.c b/libgfortran/generated/maxloc1_4_i16.c index 34fcb56..059cacb 100644 --- a/libgfortran/generated/maxloc1_4_i16.c +++ b/libgfortran/generated/maxloc1_4_i16.c @@ -58,24 +58,23 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_4_i2.c b/libgfortran/generated/maxloc1_4_i2.c index dbd7d2f..64cee3e 100644 --- a/libgfortran/generated/maxloc1_4_i2.c +++ b/libgfortran/generated/maxloc1_4_i2.c @@ -58,24 +58,23 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_4_i4.c b/libgfortran/generated/maxloc1_4_i4.c index 29d04de..f8a843e 100644 --- a/libgfortran/generated/maxloc1_4_i4.c +++ b/libgfortran/generated/maxloc1_4_i4.c @@ -58,24 +58,23 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_4_i8.c b/libgfortran/generated/maxloc1_4_i8.c index 823af36..293c2a9 100644 --- a/libgfortran/generated/maxloc1_4_i8.c +++ b/libgfortran/generated/maxloc1_4_i8.c @@ -58,24 +58,23 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_4_r10.c b/libgfortran/generated/maxloc1_4_r10.c index a212e59..8998279 100644 --- a/libgfortran/generated/maxloc1_4_r10.c +++ b/libgfortran/generated/maxloc1_4_r10.c @@ -58,24 +58,23 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_4_r16.c b/libgfortran/generated/maxloc1_4_r16.c index db3301c..191ba99 100644 --- a/libgfortran/generated/maxloc1_4_r16.c +++ b/libgfortran/generated/maxloc1_4_r16.c @@ -58,24 +58,23 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_4_r4.c b/libgfortran/generated/maxloc1_4_r4.c index a0099f6..1f445e7 100644 --- a/libgfortran/generated/maxloc1_4_r4.c +++ b/libgfortran/generated/maxloc1_4_r4.c @@ -58,24 +58,23 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c index bb7876f..170e3df 100644 --- a/libgfortran/generated/maxloc1_4_r8.c +++ b/libgfortran/generated/maxloc1_4_r8.c @@ -58,24 +58,23 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_8_i1.c b/libgfortran/generated/maxloc1_8_i1.c index 899b468..9924b71 100644 --- a/libgfortran/generated/maxloc1_8_i1.c +++ b/libgfortran/generated/maxloc1_8_i1.c @@ -58,24 +58,23 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_8_i16.c b/libgfortran/generated/maxloc1_8_i16.c index c5f7272..97946f3 100644 --- a/libgfortran/generated/maxloc1_8_i16.c +++ b/libgfortran/generated/maxloc1_8_i16.c @@ -58,24 +58,23 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_8_i2.c b/libgfortran/generated/maxloc1_8_i2.c index f20435a..d343b0b 100644 --- a/libgfortran/generated/maxloc1_8_i2.c +++ b/libgfortran/generated/maxloc1_8_i2.c @@ -58,24 +58,23 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_8_i4.c b/libgfortran/generated/maxloc1_8_i4.c index ab17f22..682de41 100644 --- a/libgfortran/generated/maxloc1_8_i4.c +++ b/libgfortran/generated/maxloc1_8_i4.c @@ -58,24 +58,23 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_8_i8.c b/libgfortran/generated/maxloc1_8_i8.c index eb72ab6..e17ecc4 100644 --- a/libgfortran/generated/maxloc1_8_i8.c +++ b/libgfortran/generated/maxloc1_8_i8.c @@ -58,24 +58,23 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_8_r10.c b/libgfortran/generated/maxloc1_8_r10.c index 8758d31..cb4b692 100644 --- a/libgfortran/generated/maxloc1_8_r10.c +++ b/libgfortran/generated/maxloc1_8_r10.c @@ -58,24 +58,23 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_8_r16.c b/libgfortran/generated/maxloc1_8_r16.c index 290929c..5a99daf 100644 --- a/libgfortran/generated/maxloc1_8_r16.c +++ b/libgfortran/generated/maxloc1_8_r16.c @@ -58,24 +58,23 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_8_r4.c b/libgfortran/generated/maxloc1_8_r4.c index a59051e..ba88d8e 100644 --- a/libgfortran/generated/maxloc1_8_r4.c +++ b/libgfortran/generated/maxloc1_8_r4.c @@ -58,24 +58,23 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c index 88410ea..6d05b43 100644 --- a/libgfortran/generated/maxloc1_8_r8.c +++ b/libgfortran/generated/maxloc1_8_r8.c @@ -58,24 +58,23 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxval_i1.c b/libgfortran/generated/maxval_i1.c index c190e06..10193fd 100644 --- a/libgfortran/generated/maxval_i1.c +++ b/libgfortran/generated/maxval_i1.c @@ -57,24 +57,23 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxval_i16.c b/libgfortran/generated/maxval_i16.c index 6b872f9..884ed66 100644 --- a/libgfortran/generated/maxval_i16.c +++ b/libgfortran/generated/maxval_i16.c @@ -57,24 +57,23 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxval_i2.c b/libgfortran/generated/maxval_i2.c index 67b8994..3abe657 100644 --- a/libgfortran/generated/maxval_i2.c +++ b/libgfortran/generated/maxval_i2.c @@ -57,24 +57,23 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxval_i4.c b/libgfortran/generated/maxval_i4.c index e7fb5bc..57aea5f 100644 --- a/libgfortran/generated/maxval_i4.c +++ b/libgfortran/generated/maxval_i4.c @@ -57,24 +57,23 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c index b90e110..9d7f57c 100644 --- a/libgfortran/generated/maxval_i8.c +++ b/libgfortran/generated/maxval_i8.c @@ -57,24 +57,23 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxval_r10.c b/libgfortran/generated/maxval_r10.c index 8585190..2259e8e 100644 --- a/libgfortran/generated/maxval_r10.c +++ b/libgfortran/generated/maxval_r10.c @@ -57,24 +57,23 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxval_r16.c b/libgfortran/generated/maxval_r16.c index d9c4566..7efdd65 100644 --- a/libgfortran/generated/maxval_r16.c +++ b/libgfortran/generated/maxval_r16.c @@ -57,24 +57,23 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxval_r4.c b/libgfortran/generated/maxval_r4.c index 1102d4c..623c25c 100644 --- a/libgfortran/generated/maxval_r4.c +++ b/libgfortran/generated/maxval_r4.c @@ -57,24 +57,23 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/maxval_r8.c b/libgfortran/generated/maxval_r8.c index ee23df7..bdbb26f 100644 --- a/libgfortran/generated/maxval_r8.c +++ b/libgfortran/generated/maxval_r8.c @@ -57,24 +57,23 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MAXVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MAXVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc0_16_i1.c b/libgfortran/generated/minloc0_16_i1.c index e0c6345..961beb9 100644 --- a/libgfortran/generated/minloc0_16_i1.c +++ b/libgfortran/generated/minloc0_16_i1.c @@ -55,9 +55,7 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ sminloc0_16_i1 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_16_i16.c b/libgfortran/generated/minloc0_16_i16.c index 1c16854..7303592 100644 --- a/libgfortran/generated/minloc0_16_i16.c +++ b/libgfortran/generated/minloc0_16_i16.c @@ -55,9 +55,7 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ sminloc0_16_i16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_16_i2.c b/libgfortran/generated/minloc0_16_i2.c index d289cfc..ee9f46c 100644 --- a/libgfortran/generated/minloc0_16_i2.c +++ b/libgfortran/generated/minloc0_16_i2.c @@ -55,9 +55,7 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ sminloc0_16_i2 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_16_i4.c b/libgfortran/generated/minloc0_16_i4.c index 88a078e..6d07bbe 100644 --- a/libgfortran/generated/minloc0_16_i4.c +++ b/libgfortran/generated/minloc0_16_i4.c @@ -55,9 +55,7 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ sminloc0_16_i4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_16_i8.c b/libgfortran/generated/minloc0_16_i8.c index b41b591..bbacc11 100644 --- a/libgfortran/generated/minloc0_16_i8.c +++ b/libgfortran/generated/minloc0_16_i8.c @@ -55,9 +55,7 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ sminloc0_16_i8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_16_r10.c b/libgfortran/generated/minloc0_16_r10.c index c79f256..a77efcd 100644 --- a/libgfortran/generated/minloc0_16_r10.c +++ b/libgfortran/generated/minloc0_16_r10.c @@ -55,9 +55,7 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ sminloc0_16_r10 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_16_r16.c b/libgfortran/generated/minloc0_16_r16.c index 75a9df5..1d29e07 100644 --- a/libgfortran/generated/minloc0_16_r16.c +++ b/libgfortran/generated/minloc0_16_r16.c @@ -55,9 +55,7 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ sminloc0_16_r16 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_16_r4.c b/libgfortran/generated/minloc0_16_r4.c index 0fb2966..1c451e9 100644 --- a/libgfortran/generated/minloc0_16_r4.c +++ b/libgfortran/generated/minloc0_16_r4.c @@ -55,9 +55,7 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ sminloc0_16_r4 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_16_r8.c b/libgfortran/generated/minloc0_16_r8.c index 317e8be..d6c7086 100644 --- a/libgfortran/generated/minloc0_16_r8.c +++ b/libgfortran/generated/minloc0_16_r8.c @@ -55,9 +55,7 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -74,7 +72,7 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -200,7 +196,7 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank); @@ -358,13 +352,13 @@ sminloc0_16_r8 (gfc_array_i16 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_4_i1.c b/libgfortran/generated/minloc0_4_i1.c index 363d4a4..418eb30d 100644 --- a/libgfortran/generated/minloc0_4_i1.c +++ b/libgfortran/generated/minloc0_4_i1.c @@ -55,9 +55,7 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ sminloc0_4_i1 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_4_i16.c b/libgfortran/generated/minloc0_4_i16.c index cca045a..9a23b27 100644 --- a/libgfortran/generated/minloc0_4_i16.c +++ b/libgfortran/generated/minloc0_4_i16.c @@ -55,9 +55,7 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ sminloc0_4_i16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_4_i2.c b/libgfortran/generated/minloc0_4_i2.c index 60e2350..df081ac 100644 --- a/libgfortran/generated/minloc0_4_i2.c +++ b/libgfortran/generated/minloc0_4_i2.c @@ -55,9 +55,7 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ sminloc0_4_i2 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_4_i4.c b/libgfortran/generated/minloc0_4_i4.c index 94a15e0..b076dcf 100644 --- a/libgfortran/generated/minloc0_4_i4.c +++ b/libgfortran/generated/minloc0_4_i4.c @@ -55,9 +55,7 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ sminloc0_4_i4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_4_i8.c b/libgfortran/generated/minloc0_4_i8.c index c556702..944694c 100644 --- a/libgfortran/generated/minloc0_4_i8.c +++ b/libgfortran/generated/minloc0_4_i8.c @@ -55,9 +55,7 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ sminloc0_4_i8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_4_r10.c b/libgfortran/generated/minloc0_4_r10.c index 62efe83..03b8fd4 100644 --- a/libgfortran/generated/minloc0_4_r10.c +++ b/libgfortran/generated/minloc0_4_r10.c @@ -55,9 +55,7 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ sminloc0_4_r10 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_4_r16.c b/libgfortran/generated/minloc0_4_r16.c index 9146890..88059c6 100644 --- a/libgfortran/generated/minloc0_4_r16.c +++ b/libgfortran/generated/minloc0_4_r16.c @@ -55,9 +55,7 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ sminloc0_4_r16 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_4_r4.c b/libgfortran/generated/minloc0_4_r4.c index 40d3c58..0b1e642 100644 --- a/libgfortran/generated/minloc0_4_r4.c +++ b/libgfortran/generated/minloc0_4_r4.c @@ -55,9 +55,7 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ sminloc0_4_r4 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_4_r8.c b/libgfortran/generated/minloc0_4_r8.c index 904811b..a6843b1 100644 --- a/libgfortran/generated/minloc0_4_r8.c +++ b/libgfortran/generated/minloc0_4_r8.c @@ -55,9 +55,7 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -74,7 +72,7 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -200,7 +196,7 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank); @@ -358,13 +352,13 @@ sminloc0_4_r8 (gfc_array_i4 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_8_i1.c b/libgfortran/generated/minloc0_8_i1.c index 9e00f07..5617aff 100644 --- a/libgfortran/generated/minloc0_8_i1.c +++ b/libgfortran/generated/minloc0_8_i1.c @@ -55,9 +55,7 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ sminloc0_8_i1 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_8_i16.c b/libgfortran/generated/minloc0_8_i16.c index bec8fa0..bc2454a 100644 --- a/libgfortran/generated/minloc0_8_i16.c +++ b/libgfortran/generated/minloc0_8_i16.c @@ -55,9 +55,7 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ sminloc0_8_i16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_8_i2.c b/libgfortran/generated/minloc0_8_i2.c index cc46e3f..198c9b9 100644 --- a/libgfortran/generated/minloc0_8_i2.c +++ b/libgfortran/generated/minloc0_8_i2.c @@ -55,9 +55,7 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ sminloc0_8_i2 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_8_i4.c b/libgfortran/generated/minloc0_8_i4.c index 9d9a3ba..c62fbcb 100644 --- a/libgfortran/generated/minloc0_8_i4.c +++ b/libgfortran/generated/minloc0_8_i4.c @@ -55,9 +55,7 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ sminloc0_8_i4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_8_i8.c b/libgfortran/generated/minloc0_8_i8.c index 4a57114..ffc7900 100644 --- a/libgfortran/generated/minloc0_8_i8.c +++ b/libgfortran/generated/minloc0_8_i8.c @@ -55,9 +55,7 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ sminloc0_8_i8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_8_r10.c b/libgfortran/generated/minloc0_8_r10.c index 6d74ee4..68eb7b6 100644 --- a/libgfortran/generated/minloc0_8_r10.c +++ b/libgfortran/generated/minloc0_8_r10.c @@ -55,9 +55,7 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ sminloc0_8_r10 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_8_r16.c b/libgfortran/generated/minloc0_8_r16.c index 8a112f9..da7ae06 100644 --- a/libgfortran/generated/minloc0_8_r16.c +++ b/libgfortran/generated/minloc0_8_r16.c @@ -55,9 +55,7 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ sminloc0_8_r16 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_8_r4.c b/libgfortran/generated/minloc0_8_r4.c index 2f81720..fbf5bab 100644 --- a/libgfortran/generated/minloc0_8_r4.c +++ b/libgfortran/generated/minloc0_8_r4.c @@ -55,9 +55,7 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ sminloc0_8_r4 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc0_8_r8.c b/libgfortran/generated/minloc0_8_r8.c index 0e1df47..2dd4cfd 100644 --- a/libgfortran/generated/minloc0_8_r8.c +++ b/libgfortran/generated/minloc0_8_r8.c @@ -55,9 +55,7 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -74,7 +72,7 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -82,12 +80,12 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -179,9 +177,7 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -200,7 +196,7 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " MINLOC intrnisic: is %ld, should be %ld", @@ -214,8 +210,8 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -238,13 +234,13 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -339,9 +335,7 @@ sminloc0_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank); @@ -358,13 +352,13 @@ sminloc0_8_r8 (gfc_array_i8 * const restrict retarray, runtime_error ("rank of return array in MINLOC intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = 0 ; diff --git a/libgfortran/generated/minloc1_16_i1.c b/libgfortran/generated/minloc1_16_i1.c index 06127ce..5a5ff5e 100644 --- a/libgfortran/generated/minloc1_16_i1.c +++ b/libgfortran/generated/minloc1_16_i1.c @@ -58,24 +58,23 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_16_i16.c b/libgfortran/generated/minloc1_16_i16.c index fb0d027..25d4ceaa 100644 --- a/libgfortran/generated/minloc1_16_i16.c +++ b/libgfortran/generated/minloc1_16_i16.c @@ -58,24 +58,23 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_16_i2.c b/libgfortran/generated/minloc1_16_i2.c index 4a58cc1..228a582 100644 --- a/libgfortran/generated/minloc1_16_i2.c +++ b/libgfortran/generated/minloc1_16_i2.c @@ -58,24 +58,23 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_16_i4.c b/libgfortran/generated/minloc1_16_i4.c index 549fd25..c865272 100644 --- a/libgfortran/generated/minloc1_16_i4.c +++ b/libgfortran/generated/minloc1_16_i4.c @@ -58,24 +58,23 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_16_i8.c b/libgfortran/generated/minloc1_16_i8.c index ea4e854..fa12444 100644 --- a/libgfortran/generated/minloc1_16_i8.c +++ b/libgfortran/generated/minloc1_16_i8.c @@ -58,24 +58,23 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_16_r10.c b/libgfortran/generated/minloc1_16_r10.c index 7696c16..15862a8 100644 --- a/libgfortran/generated/minloc1_16_r10.c +++ b/libgfortran/generated/minloc1_16_r10.c @@ -58,24 +58,23 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_16_r16.c b/libgfortran/generated/minloc1_16_r16.c index 21cee90..f0b452f 100644 --- a/libgfortran/generated/minloc1_16_r16.c +++ b/libgfortran/generated/minloc1_16_r16.c @@ -58,24 +58,23 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_16_r4.c b/libgfortran/generated/minloc1_16_r4.c index b17faef..692259d 100644 --- a/libgfortran/generated/minloc1_16_r4.c +++ b/libgfortran/generated/minloc1_16_r4.c @@ -58,24 +58,23 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_16_r8.c b/libgfortran/generated/minloc1_16_r8.c index bdf917c..c0189da 100644 --- a/libgfortran/generated/minloc1_16_r8.c +++ b/libgfortran/generated/minloc1_16_r8.c @@ -58,24 +58,23 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_4_i1.c b/libgfortran/generated/minloc1_4_i1.c index 2a86922..164f7ec 100644 --- a/libgfortran/generated/minloc1_4_i1.c +++ b/libgfortran/generated/minloc1_4_i1.c @@ -58,24 +58,23 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_4_i16.c b/libgfortran/generated/minloc1_4_i16.c index 93f7ca2..899f202 100644 --- a/libgfortran/generated/minloc1_4_i16.c +++ b/libgfortran/generated/minloc1_4_i16.c @@ -58,24 +58,23 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_4_i2.c b/libgfortran/generated/minloc1_4_i2.c index 6bc8f57..f900506 100644 --- a/libgfortran/generated/minloc1_4_i2.c +++ b/libgfortran/generated/minloc1_4_i2.c @@ -58,24 +58,23 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_4_i4.c b/libgfortran/generated/minloc1_4_i4.c index 685d242..7dedb8f 100644 --- a/libgfortran/generated/minloc1_4_i4.c +++ b/libgfortran/generated/minloc1_4_i4.c @@ -58,24 +58,23 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c index b3f506a..70eaefa 100644 --- a/libgfortran/generated/minloc1_4_i8.c +++ b/libgfortran/generated/minloc1_4_i8.c @@ -58,24 +58,23 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_4_r10.c b/libgfortran/generated/minloc1_4_r10.c index 8d93866..1a0bdfa 100644 --- a/libgfortran/generated/minloc1_4_r10.c +++ b/libgfortran/generated/minloc1_4_r10.c @@ -58,24 +58,23 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_4_r16.c b/libgfortran/generated/minloc1_4_r16.c index b2909ab..b8849a5 100644 --- a/libgfortran/generated/minloc1_4_r16.c +++ b/libgfortran/generated/minloc1_4_r16.c @@ -58,24 +58,23 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_4_r4.c b/libgfortran/generated/minloc1_4_r4.c index 9741c2b..cc382db 100644 --- a/libgfortran/generated/minloc1_4_r4.c +++ b/libgfortran/generated/minloc1_4_r4.c @@ -58,24 +58,23 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_4_r8.c b/libgfortran/generated/minloc1_4_r8.c index 4b26710..c36567f 100644 --- a/libgfortran/generated/minloc1_4_r8.c +++ b/libgfortran/generated/minloc1_4_r8.c @@ -58,24 +58,23 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_8_i1.c b/libgfortran/generated/minloc1_8_i1.c index b92faa7..6e46c82 100644 --- a/libgfortran/generated/minloc1_8_i1.c +++ b/libgfortran/generated/minloc1_8_i1.c @@ -58,24 +58,23 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_8_i16.c b/libgfortran/generated/minloc1_8_i16.c index d928395..8e8410a 100644 --- a/libgfortran/generated/minloc1_8_i16.c +++ b/libgfortran/generated/minloc1_8_i16.c @@ -58,24 +58,23 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_8_i2.c b/libgfortran/generated/minloc1_8_i2.c index b012f96..2a33e3c 100644 --- a/libgfortran/generated/minloc1_8_i2.c +++ b/libgfortran/generated/minloc1_8_i2.c @@ -58,24 +58,23 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_8_i4.c b/libgfortran/generated/minloc1_8_i4.c index 107bf8f..70cdef6 100644 --- a/libgfortran/generated/minloc1_8_i4.c +++ b/libgfortran/generated/minloc1_8_i4.c @@ -58,24 +58,23 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_8_i8.c b/libgfortran/generated/minloc1_8_i8.c index 16073fe..c1a01e9 100644 --- a/libgfortran/generated/minloc1_8_i8.c +++ b/libgfortran/generated/minloc1_8_i8.c @@ -58,24 +58,23 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_8_r10.c b/libgfortran/generated/minloc1_8_r10.c index 3acd9c3..b5a6c8d 100644 --- a/libgfortran/generated/minloc1_8_r10.c +++ b/libgfortran/generated/minloc1_8_r10.c @@ -58,24 +58,23 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c index e194986..0f4b036 100644 --- a/libgfortran/generated/minloc1_8_r16.c +++ b/libgfortran/generated/minloc1_8_r16.c @@ -58,24 +58,23 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_8_r4.c b/libgfortran/generated/minloc1_8_r4.c index 1e32884..300b5be 100644 --- a/libgfortran/generated/minloc1_8_r4.c +++ b/libgfortran/generated/minloc1_8_r4.c @@ -58,24 +58,23 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minloc1_8_r8.c b/libgfortran/generated/minloc1_8_r8.c index 85ad5b7..da498f6 100644 --- a/libgfortran/generated/minloc1_8_r8.c +++ b/libgfortran/generated/minloc1_8_r8.c @@ -58,24 +58,23 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -83,30 +82,31 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -125,8 +125,7 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -139,7 +138,7 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -236,7 +235,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -253,14 +252,14 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -268,10 +267,9 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -279,19 +277,20 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -300,8 +299,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -319,8 +317,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -331,8 +328,8 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINLOC intrinsic in dimension %ld:" @@ -345,7 +342,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -448,8 +445,8 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -457,9 +454,9 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -467,29 +464,29 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -509,8 +506,7 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINLOC intrinsic in dimension %ld:" @@ -523,7 +519,7 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minval_i1.c b/libgfortran/generated/minval_i1.c index f761faa..437232a 100644 --- a/libgfortran/generated/minval_i1.c +++ b/libgfortran/generated/minval_i1.c @@ -57,24 +57,23 @@ minval_i1 (gfc_array_i1 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ minval_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ minval_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ minval_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ sminval_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ sminval_i1 (gfc_array_i1 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ sminval_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ sminval_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ sminval_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minval_i16.c b/libgfortran/generated/minval_i16.c index e0bd733..f0bd16f 100644 --- a/libgfortran/generated/minval_i16.c +++ b/libgfortran/generated/minval_i16.c @@ -57,24 +57,23 @@ minval_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ minval_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ minval_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ minval_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ sminval_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ sminval_i16 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ sminval_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ sminval_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ sminval_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minval_i2.c b/libgfortran/generated/minval_i2.c index bfa14b2..08fd3a6 100644 --- a/libgfortran/generated/minval_i2.c +++ b/libgfortran/generated/minval_i2.c @@ -57,24 +57,23 @@ minval_i2 (gfc_array_i2 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ minval_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ minval_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ minval_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ sminval_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ sminval_i2 (gfc_array_i2 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ sminval_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ sminval_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ sminval_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minval_i4.c b/libgfortran/generated/minval_i4.c index ba1e592..d7e1ef9 100644 --- a/libgfortran/generated/minval_i4.c +++ b/libgfortran/generated/minval_i4.c @@ -57,24 +57,23 @@ minval_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ minval_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ minval_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ minval_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ sminval_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ sminval_i4 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ sminval_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ sminval_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ sminval_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minval_i8.c b/libgfortran/generated/minval_i8.c index 0287e05..7b6fdc5 100644 --- a/libgfortran/generated/minval_i8.c +++ b/libgfortran/generated/minval_i8.c @@ -57,24 +57,23 @@ minval_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ minval_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ minval_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ minval_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ sminval_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ sminval_i8 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ sminval_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ sminval_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ sminval_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minval_r10.c b/libgfortran/generated/minval_r10.c index 202ae7f..1f6a75f 100644 --- a/libgfortran/generated/minval_r10.c +++ b/libgfortran/generated/minval_r10.c @@ -57,24 +57,23 @@ minval_r10 (gfc_array_r10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ minval_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ minval_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ minval_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ sminval_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ sminval_r10 (gfc_array_r10 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ sminval_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ sminval_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ sminval_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minval_r16.c b/libgfortran/generated/minval_r16.c index fe4210f..555d86f 100644 --- a/libgfortran/generated/minval_r16.c +++ b/libgfortran/generated/minval_r16.c @@ -57,24 +57,23 @@ minval_r16 (gfc_array_r16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ minval_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ minval_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ minval_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ sminval_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ sminval_r16 (gfc_array_r16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ sminval_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ sminval_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ sminval_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minval_r4.c b/libgfortran/generated/minval_r4.c index 7dcd567..a7f729e 100644 --- a/libgfortran/generated/minval_r4.c +++ b/libgfortran/generated/minval_r4.c @@ -57,24 +57,23 @@ minval_r4 (gfc_array_r4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ minval_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ minval_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ minval_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ sminval_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ sminval_r4 (gfc_array_r4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ sminval_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ sminval_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ sminval_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/minval_r8.c b/libgfortran/generated/minval_r8.c index e92842f..69afca1 100644 --- a/libgfortran/generated/minval_r8.c +++ b/libgfortran/generated/minval_r8.c @@ -57,24 +57,23 @@ minval_r8 (gfc_array_r8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ minval_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ minval_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ minval_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -230,7 +229,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -247,14 +246,14 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -262,10 +261,9 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -273,19 +271,20 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -294,8 +293,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -313,8 +311,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -325,8 +322,8 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " MINVAL intrinsic in dimension %ld:" @@ -339,7 +336,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -437,8 +434,8 @@ sminval_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -446,9 +443,9 @@ sminval_r8 (gfc_array_r8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -456,29 +453,29 @@ sminval_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -498,8 +495,7 @@ sminval_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " MINVAL intrinsic in dimension %ld:" @@ -512,7 +508,7 @@ sminval_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/pack_c10.c b/libgfortran/generated/pack_c10.c index 29b1c5b..008fb5c 100644 --- a/libgfortran/generated/pack_c10.c +++ b/libgfortran/generated/pack_c10.c @@ -122,11 +122,11 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_c16.c b/libgfortran/generated/pack_c16.c index d858941..e7d039f 100644 --- a/libgfortran/generated/pack_c16.c +++ b/libgfortran/generated/pack_c16.c @@ -122,11 +122,11 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_c4.c b/libgfortran/generated/pack_c4.c index 5b69c98..fe1f68d 100644 --- a/libgfortran/generated/pack_c4.c +++ b/libgfortran/generated/pack_c4.c @@ -122,11 +122,11 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_c8.c b/libgfortran/generated/pack_c8.c index 2d61cb1..f5a27ec 100644 --- a/libgfortran/generated/pack_c8.c +++ b/libgfortran/generated/pack_c8.c @@ -122,11 +122,11 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_i1.c b/libgfortran/generated/pack_i1.c index 32b04c2..edc8950 100644 --- a/libgfortran/generated/pack_i1.c +++ b/libgfortran/generated/pack_i1.c @@ -122,11 +122,11 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_i16.c b/libgfortran/generated/pack_i16.c index 36c9252..8f38a27 100644 --- a/libgfortran/generated/pack_i16.c +++ b/libgfortran/generated/pack_i16.c @@ -122,11 +122,11 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_i2.c b/libgfortran/generated/pack_i2.c index b510231..149e9f6 100644 --- a/libgfortran/generated/pack_i2.c +++ b/libgfortran/generated/pack_i2.c @@ -122,11 +122,11 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_i4.c b/libgfortran/generated/pack_i4.c index b350b89..dad10d6 100644 --- a/libgfortran/generated/pack_i4.c +++ b/libgfortran/generated/pack_i4.c @@ -122,11 +122,11 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_i8.c b/libgfortran/generated/pack_i8.c index 25f0883..0a23aa5 100644 --- a/libgfortran/generated/pack_i8.c +++ b/libgfortran/generated/pack_i8.c @@ -122,11 +122,11 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_r10.c b/libgfortran/generated/pack_r10.c index e1f3041..e4bbe6f 100644 --- a/libgfortran/generated/pack_r10.c +++ b/libgfortran/generated/pack_r10.c @@ -122,11 +122,11 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_r16.c b/libgfortran/generated/pack_r16.c index 834ef55..7dff30b 100644 --- a/libgfortran/generated/pack_r16.c +++ b/libgfortran/generated/pack_r16.c @@ -122,11 +122,11 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_r4.c b/libgfortran/generated/pack_r4.c index 859e216..51d46a2 100644 --- a/libgfortran/generated/pack_r4.c +++ b/libgfortran/generated/pack_r4.c @@ -122,11 +122,11 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/pack_r8.c b/libgfortran/generated/pack_r8.c index ba2e60d..582c2b9 100644 --- a/libgfortran/generated/pack_r8.c +++ b/libgfortran/generated/pack_r8.c @@ -122,11 +122,11 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -147,7 +147,7 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -215,9 +215,7 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -234,7 +232,7 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -242,7 +240,7 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -291,11 +289,11 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/generated/product_c10.c b/libgfortran/generated/product_c10.c index 5fcba79..69f7f8b 100644 --- a/libgfortran/generated/product_c10.c +++ b/libgfortran/generated/product_c10.c @@ -57,24 +57,23 @@ product_c10 (gfc_array_c10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_c10 (gfc_array_c10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_c10 (gfc_array_c10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_c10 (gfc_array_c10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_COMPLEX_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_c16.c b/libgfortran/generated/product_c16.c index ffa5836..efaed2c 100644 --- a/libgfortran/generated/product_c16.c +++ b/libgfortran/generated/product_c16.c @@ -57,24 +57,23 @@ product_c16 (gfc_array_c16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_c16 (gfc_array_c16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_c16 (gfc_array_c16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_c16 (gfc_array_c16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_COMPLEX_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_c4.c b/libgfortran/generated/product_c4.c index c2301d6..505647e 100644 --- a/libgfortran/generated/product_c4.c +++ b/libgfortran/generated/product_c4.c @@ -57,24 +57,23 @@ product_c4 (gfc_array_c4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_c4 (gfc_array_c4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_c4 (gfc_array_c4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_c4 (gfc_array_c4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_COMPLEX_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_c8.c b/libgfortran/generated/product_c8.c index 3c36570..16c776a 100644 --- a/libgfortran/generated/product_c8.c +++ b/libgfortran/generated/product_c8.c @@ -57,24 +57,23 @@ product_c8 (gfc_array_c8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_c8 (gfc_array_c8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_c8 (gfc_array_c8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_c8 (gfc_array_c8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_COMPLEX_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_i1.c b/libgfortran/generated/product_i1.c index ab177fa..cbc1ab1 100644 --- a/libgfortran/generated/product_i1.c +++ b/libgfortran/generated/product_i1.c @@ -57,24 +57,23 @@ product_i1 (gfc_array_i1 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_i16.c b/libgfortran/generated/product_i16.c index 12b0fa4..e3b8c2a0 100644 --- a/libgfortran/generated/product_i16.c +++ b/libgfortran/generated/product_i16.c @@ -57,24 +57,23 @@ product_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_i2.c b/libgfortran/generated/product_i2.c index b43e871..507d956 100644 --- a/libgfortran/generated/product_i2.c +++ b/libgfortran/generated/product_i2.c @@ -57,24 +57,23 @@ product_i2 (gfc_array_i2 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_i4.c b/libgfortran/generated/product_i4.c index 907fce8..d5af367 100644 --- a/libgfortran/generated/product_i4.c +++ b/libgfortran/generated/product_i4.c @@ -57,24 +57,23 @@ product_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_i8.c b/libgfortran/generated/product_i8.c index 3d88698..3308d91 100644 --- a/libgfortran/generated/product_i8.c +++ b/libgfortran/generated/product_i8.c @@ -57,24 +57,23 @@ product_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_r10.c b/libgfortran/generated/product_r10.c index 9da4722..7bae904 100644 --- a/libgfortran/generated/product_r10.c +++ b/libgfortran/generated/product_r10.c @@ -57,24 +57,23 @@ product_r10 (gfc_array_r10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_r16.c b/libgfortran/generated/product_r16.c index 55c2303..bb67872 100644 --- a/libgfortran/generated/product_r16.c +++ b/libgfortran/generated/product_r16.c @@ -57,24 +57,23 @@ product_r16 (gfc_array_r16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_r4.c b/libgfortran/generated/product_r4.c index 7a66bdc..333c13d 100644 --- a/libgfortran/generated/product_r4.c +++ b/libgfortran/generated/product_r4.c @@ -57,24 +57,23 @@ product_r4 (gfc_array_r4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/product_r8.c b/libgfortran/generated/product_r8.c index d120369..46258c0 100644 --- a/libgfortran/generated/product_r8.c +++ b/libgfortran/generated/product_r8.c @@ -57,24 +57,23 @@ product_r8 (gfc_array_r8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ product_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ product_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ product_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " PRODUCT intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " PRODUCT intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/reshape_c10.c b/libgfortran/generated/reshape_c10.c index 4a4094c..34eff90 100644 --- a/libgfortran/generated/reshape_c10.c +++ b/libgfortran/generated/reshape_c10.c @@ -1,4 +1,4 @@ -/* Implementation of the RESHAPE +/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -79,7 +79,7 @@ reshape_c10 (gfc_array_c10 * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -87,7 +87,7 @@ reshape_c10 (gfc_array_c10 * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -100,10 +100,10 @@ reshape_c10 (gfc_array_c10 * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -122,8 +122,8 @@ reshape_c10 (gfc_array_c10 * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -153,7 +153,7 @@ reshape_c10 (gfc_array_c10 * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -166,7 +166,7 @@ reshape_c10 (gfc_array_c10 * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -185,7 +185,7 @@ reshape_c10 (gfc_array_c10 * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -204,13 +204,13 @@ reshape_c10 (gfc_array_c10 * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -231,8 +231,8 @@ reshape_c10 (gfc_array_c10 * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/generated/reshape_c16.c b/libgfortran/generated/reshape_c16.c index a2cec54..569b76ce 100644 --- a/libgfortran/generated/reshape_c16.c +++ b/libgfortran/generated/reshape_c16.c @@ -1,4 +1,4 @@ -/* Implementation of the RESHAPE +/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -79,7 +79,7 @@ reshape_c16 (gfc_array_c16 * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -87,7 +87,7 @@ reshape_c16 (gfc_array_c16 * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -100,10 +100,10 @@ reshape_c16 (gfc_array_c16 * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -122,8 +122,8 @@ reshape_c16 (gfc_array_c16 * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -153,7 +153,7 @@ reshape_c16 (gfc_array_c16 * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -166,7 +166,7 @@ reshape_c16 (gfc_array_c16 * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -185,7 +185,7 @@ reshape_c16 (gfc_array_c16 * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -204,13 +204,13 @@ reshape_c16 (gfc_array_c16 * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -231,8 +231,8 @@ reshape_c16 (gfc_array_c16 * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/generated/reshape_c4.c b/libgfortran/generated/reshape_c4.c index 95fbb79..c8b7355 100644 --- a/libgfortran/generated/reshape_c4.c +++ b/libgfortran/generated/reshape_c4.c @@ -1,4 +1,4 @@ -/* Implementation of the RESHAPE +/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -79,7 +79,7 @@ reshape_c4 (gfc_array_c4 * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -87,7 +87,7 @@ reshape_c4 (gfc_array_c4 * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -100,10 +100,10 @@ reshape_c4 (gfc_array_c4 * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -122,8 +122,8 @@ reshape_c4 (gfc_array_c4 * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -153,7 +153,7 @@ reshape_c4 (gfc_array_c4 * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -166,7 +166,7 @@ reshape_c4 (gfc_array_c4 * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -185,7 +185,7 @@ reshape_c4 (gfc_array_c4 * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -204,13 +204,13 @@ reshape_c4 (gfc_array_c4 * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -231,8 +231,8 @@ reshape_c4 (gfc_array_c4 * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/generated/reshape_c8.c b/libgfortran/generated/reshape_c8.c index a34127c..1a390b4 100644 --- a/libgfortran/generated/reshape_c8.c +++ b/libgfortran/generated/reshape_c8.c @@ -1,4 +1,4 @@ -/* Implementation of the RESHAPE +/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -79,7 +79,7 @@ reshape_c8 (gfc_array_c8 * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -87,7 +87,7 @@ reshape_c8 (gfc_array_c8 * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -100,10 +100,10 @@ reshape_c8 (gfc_array_c8 * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -122,8 +122,8 @@ reshape_c8 (gfc_array_c8 * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -153,7 +153,7 @@ reshape_c8 (gfc_array_c8 * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -166,7 +166,7 @@ reshape_c8 (gfc_array_c8 * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -185,7 +185,7 @@ reshape_c8 (gfc_array_c8 * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -204,13 +204,13 @@ reshape_c8 (gfc_array_c8 * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -231,8 +231,8 @@ reshape_c8 (gfc_array_c8 * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/generated/reshape_i16.c b/libgfortran/generated/reshape_i16.c index e40be60..4f69ce0 100644 --- a/libgfortran/generated/reshape_i16.c +++ b/libgfortran/generated/reshape_i16.c @@ -1,4 +1,4 @@ -/* Implementation of the RESHAPE +/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -79,7 +79,7 @@ reshape_16 (gfc_array_i16 * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -87,7 +87,7 @@ reshape_16 (gfc_array_i16 * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -100,10 +100,10 @@ reshape_16 (gfc_array_i16 * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -122,8 +122,8 @@ reshape_16 (gfc_array_i16 * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -153,7 +153,7 @@ reshape_16 (gfc_array_i16 * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -166,7 +166,7 @@ reshape_16 (gfc_array_i16 * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -185,7 +185,7 @@ reshape_16 (gfc_array_i16 * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -204,13 +204,13 @@ reshape_16 (gfc_array_i16 * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -231,8 +231,8 @@ reshape_16 (gfc_array_i16 * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/generated/reshape_i4.c b/libgfortran/generated/reshape_i4.c index 4b76fdb..53016bd 100644 --- a/libgfortran/generated/reshape_i4.c +++ b/libgfortran/generated/reshape_i4.c @@ -1,4 +1,4 @@ -/* Implementation of the RESHAPE +/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -79,7 +79,7 @@ reshape_4 (gfc_array_i4 * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -87,7 +87,7 @@ reshape_4 (gfc_array_i4 * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -100,10 +100,10 @@ reshape_4 (gfc_array_i4 * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -122,8 +122,8 @@ reshape_4 (gfc_array_i4 * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -153,7 +153,7 @@ reshape_4 (gfc_array_i4 * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -166,7 +166,7 @@ reshape_4 (gfc_array_i4 * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -185,7 +185,7 @@ reshape_4 (gfc_array_i4 * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -204,13 +204,13 @@ reshape_4 (gfc_array_i4 * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -231,8 +231,8 @@ reshape_4 (gfc_array_i4 * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/generated/reshape_i8.c b/libgfortran/generated/reshape_i8.c index 8856e81..34620cf 100644 --- a/libgfortran/generated/reshape_i8.c +++ b/libgfortran/generated/reshape_i8.c @@ -1,4 +1,4 @@ -/* Implementation of the RESHAPE +/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -79,7 +79,7 @@ reshape_8 (gfc_array_i8 * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -87,7 +87,7 @@ reshape_8 (gfc_array_i8 * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -100,10 +100,10 @@ reshape_8 (gfc_array_i8 * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -122,8 +122,8 @@ reshape_8 (gfc_array_i8 * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -153,7 +153,7 @@ reshape_8 (gfc_array_i8 * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -166,7 +166,7 @@ reshape_8 (gfc_array_i8 * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -185,7 +185,7 @@ reshape_8 (gfc_array_i8 * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -204,13 +204,13 @@ reshape_8 (gfc_array_i8 * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -231,8 +231,8 @@ reshape_8 (gfc_array_i8 * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/generated/reshape_r10.c b/libgfortran/generated/reshape_r10.c index 3e08b7c..3bf319a 100644 --- a/libgfortran/generated/reshape_r10.c +++ b/libgfortran/generated/reshape_r10.c @@ -1,4 +1,4 @@ -/* Implementation of the RESHAPE +/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -79,7 +79,7 @@ reshape_r10 (gfc_array_r10 * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -87,7 +87,7 @@ reshape_r10 (gfc_array_r10 * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -100,10 +100,10 @@ reshape_r10 (gfc_array_r10 * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -122,8 +122,8 @@ reshape_r10 (gfc_array_r10 * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -153,7 +153,7 @@ reshape_r10 (gfc_array_r10 * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -166,7 +166,7 @@ reshape_r10 (gfc_array_r10 * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -185,7 +185,7 @@ reshape_r10 (gfc_array_r10 * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -204,13 +204,13 @@ reshape_r10 (gfc_array_r10 * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -231,8 +231,8 @@ reshape_r10 (gfc_array_r10 * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/generated/reshape_r16.c b/libgfortran/generated/reshape_r16.c index d78df12..6794b50 100644 --- a/libgfortran/generated/reshape_r16.c +++ b/libgfortran/generated/reshape_r16.c @@ -1,4 +1,4 @@ -/* Implementation of the RESHAPE +/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -79,7 +79,7 @@ reshape_r16 (gfc_array_r16 * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -87,7 +87,7 @@ reshape_r16 (gfc_array_r16 * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -100,10 +100,10 @@ reshape_r16 (gfc_array_r16 * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -122,8 +122,8 @@ reshape_r16 (gfc_array_r16 * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -153,7 +153,7 @@ reshape_r16 (gfc_array_r16 * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -166,7 +166,7 @@ reshape_r16 (gfc_array_r16 * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -185,7 +185,7 @@ reshape_r16 (gfc_array_r16 * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -204,13 +204,13 @@ reshape_r16 (gfc_array_r16 * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -231,8 +231,8 @@ reshape_r16 (gfc_array_r16 * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/generated/reshape_r4.c b/libgfortran/generated/reshape_r4.c index 1577058..e7bfbfb 100644 --- a/libgfortran/generated/reshape_r4.c +++ b/libgfortran/generated/reshape_r4.c @@ -1,4 +1,4 @@ -/* Implementation of the RESHAPE +/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -79,7 +79,7 @@ reshape_r4 (gfc_array_r4 * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -87,7 +87,7 @@ reshape_r4 (gfc_array_r4 * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -100,10 +100,10 @@ reshape_r4 (gfc_array_r4 * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -122,8 +122,8 @@ reshape_r4 (gfc_array_r4 * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -153,7 +153,7 @@ reshape_r4 (gfc_array_r4 * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -166,7 +166,7 @@ reshape_r4 (gfc_array_r4 * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -185,7 +185,7 @@ reshape_r4 (gfc_array_r4 * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -204,13 +204,13 @@ reshape_r4 (gfc_array_r4 * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -231,8 +231,8 @@ reshape_r4 (gfc_array_r4 * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/generated/reshape_r8.c b/libgfortran/generated/reshape_r8.c index dcbedb8..d0441c0 100644 --- a/libgfortran/generated/reshape_r8.c +++ b/libgfortran/generated/reshape_r8.c @@ -1,4 +1,4 @@ -/* Implementation of the RESHAPE +/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -79,7 +79,7 @@ reshape_r8 (gfc_array_r8 * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -87,7 +87,7 @@ reshape_r8 (gfc_array_r8 * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -100,10 +100,10 @@ reshape_r8 (gfc_array_r8 * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -122,8 +122,8 @@ reshape_r8 (gfc_array_r8 * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -153,7 +153,7 @@ reshape_r8 (gfc_array_r8 * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -166,7 +166,7 @@ reshape_r8 (gfc_array_r8 * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -185,7 +185,7 @@ reshape_r8 (gfc_array_r8 * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -204,13 +204,13 @@ reshape_r8 (gfc_array_r8 * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -231,8 +231,8 @@ reshape_r8 (gfc_array_r8 * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/generated/shape_i16.c b/libgfortran/generated/shape_i16.c index 249793d..9ce2857 100644 --- a/libgfortran/generated/shape_i16.c +++ b/libgfortran/generated/shape_i16.c @@ -42,14 +42,14 @@ shape_16 (gfc_array_i16 * const restrict ret, index_type stride; index_type extent; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); - if (ret->dim[0].ubound < ret->dim[0].lbound) + if (GFC_DESCRIPTOR_EXTENT(ret,0) < 1) return; for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++) { - extent = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent = GFC_DESCRIPTOR_EXTENT(array,n); ret->data[n * stride] = extent > 0 ? extent : 0 ; } } diff --git a/libgfortran/generated/shape_i4.c b/libgfortran/generated/shape_i4.c index 386b84e..1b23335 100644 --- a/libgfortran/generated/shape_i4.c +++ b/libgfortran/generated/shape_i4.c @@ -42,14 +42,14 @@ shape_4 (gfc_array_i4 * const restrict ret, index_type stride; index_type extent; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); - if (ret->dim[0].ubound < ret->dim[0].lbound) + if (GFC_DESCRIPTOR_EXTENT(ret,0) < 1) return; for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++) { - extent = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent = GFC_DESCRIPTOR_EXTENT(array,n); ret->data[n * stride] = extent > 0 ? extent : 0 ; } } diff --git a/libgfortran/generated/shape_i8.c b/libgfortran/generated/shape_i8.c index f0498bc..efe00a5 100644 --- a/libgfortran/generated/shape_i8.c +++ b/libgfortran/generated/shape_i8.c @@ -42,14 +42,14 @@ shape_8 (gfc_array_i8 * const restrict ret, index_type stride; index_type extent; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); - if (ret->dim[0].ubound < ret->dim[0].lbound) + if (GFC_DESCRIPTOR_EXTENT(ret,0) < 1) return; for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++) { - extent = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent = GFC_DESCRIPTOR_EXTENT(array,n); ret->data[n * stride] = extent > 0 ? extent : 0 ; } } diff --git a/libgfortran/generated/spread_c10.c b/libgfortran/generated/spread_c10.c index d7e1ee1..77a838f0 100644 --- a/libgfortran/generated/spread_c10.c +++ b/libgfortran/generated/spread_c10.c @@ -69,6 +69,9 @@ spread_c10 (gfc_array_c10 *ret, const gfc_array_c10 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_c10 (gfc_array_c10 *ret, const gfc_array_c10 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_c10 (gfc_array_c10 *ret, const gfc_array_c10 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_c10 (gfc_array_c10 *ret, const gfc_array_c10 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_c10 (gfc_array_c10 *ret, const gfc_array_c10 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_c10 (gfc_array_c10 *ret, const gfc_array_c10 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_c10 (gfc_array_c10 *ret, const GFC_COMPLEX_10 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_COMPLEX_10)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_c16.c b/libgfortran/generated/spread_c16.c index d57cdd9..1276e4d 100644 --- a/libgfortran/generated/spread_c16.c +++ b/libgfortran/generated/spread_c16.c @@ -69,6 +69,9 @@ spread_c16 (gfc_array_c16 *ret, const gfc_array_c16 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_c16 (gfc_array_c16 *ret, const gfc_array_c16 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_c16 (gfc_array_c16 *ret, const gfc_array_c16 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_c16 (gfc_array_c16 *ret, const gfc_array_c16 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_c16 (gfc_array_c16 *ret, const gfc_array_c16 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_c16 (gfc_array_c16 *ret, const gfc_array_c16 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_c16 (gfc_array_c16 *ret, const GFC_COMPLEX_16 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_COMPLEX_16)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_c4.c b/libgfortran/generated/spread_c4.c index ddd6305..5224e84 100644 --- a/libgfortran/generated/spread_c4.c +++ b/libgfortran/generated/spread_c4.c @@ -69,6 +69,9 @@ spread_c4 (gfc_array_c4 *ret, const gfc_array_c4 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_c4 (gfc_array_c4 *ret, const gfc_array_c4 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_c4 (gfc_array_c4 *ret, const gfc_array_c4 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_c4 (gfc_array_c4 *ret, const gfc_array_c4 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_c4 (gfc_array_c4 *ret, const gfc_array_c4 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_c4 (gfc_array_c4 *ret, const gfc_array_c4 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_c4 (gfc_array_c4 *ret, const GFC_COMPLEX_4 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_COMPLEX_4)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_c8.c b/libgfortran/generated/spread_c8.c index 8a32ee4..96ecb3a 100644 --- a/libgfortran/generated/spread_c8.c +++ b/libgfortran/generated/spread_c8.c @@ -69,6 +69,9 @@ spread_c8 (gfc_array_c8 *ret, const gfc_array_c8 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_c8 (gfc_array_c8 *ret, const gfc_array_c8 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_c8 (gfc_array_c8 *ret, const gfc_array_c8 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_c8 (gfc_array_c8 *ret, const gfc_array_c8 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_c8 (gfc_array_c8 *ret, const gfc_array_c8 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_c8 (gfc_array_c8 *ret, const gfc_array_c8 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_c8 (gfc_array_c8 *ret, const GFC_COMPLEX_8 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_COMPLEX_8)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_i1.c b/libgfortran/generated/spread_i1.c index e5a2c34f..e002c14 100644 --- a/libgfortran/generated/spread_i1.c +++ b/libgfortran/generated/spread_i1.c @@ -69,6 +69,9 @@ spread_i1 (gfc_array_i1 *ret, const gfc_array_i1 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_i1 (gfc_array_i1 *ret, const gfc_array_i1 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_i1 (gfc_array_i1 *ret, const gfc_array_i1 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_i1 (gfc_array_i1 *ret, const gfc_array_i1 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_i1 (gfc_array_i1 *ret, const gfc_array_i1 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_i1 (gfc_array_i1 *ret, const gfc_array_i1 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_i1 (gfc_array_i1 *ret, const GFC_INTEGER_1 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_INTEGER_1)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_i16.c b/libgfortran/generated/spread_i16.c index a454557..bdefdac 100644 --- a/libgfortran/generated/spread_i16.c +++ b/libgfortran/generated/spread_i16.c @@ -69,6 +69,9 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_i16 (gfc_array_i16 *ret, const GFC_INTEGER_16 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_INTEGER_16)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_i2.c b/libgfortran/generated/spread_i2.c index 3bcccb1..8482cfd 100644 --- a/libgfortran/generated/spread_i2.c +++ b/libgfortran/generated/spread_i2.c @@ -69,6 +69,9 @@ spread_i2 (gfc_array_i2 *ret, const gfc_array_i2 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_i2 (gfc_array_i2 *ret, const gfc_array_i2 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_i2 (gfc_array_i2 *ret, const gfc_array_i2 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_i2 (gfc_array_i2 *ret, const gfc_array_i2 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_i2 (gfc_array_i2 *ret, const gfc_array_i2 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_i2 (gfc_array_i2 *ret, const gfc_array_i2 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_i2 (gfc_array_i2 *ret, const GFC_INTEGER_2 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_INTEGER_2)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_i4.c b/libgfortran/generated/spread_i4.c index 336ca7c..6eff632 100644 --- a/libgfortran/generated/spread_i4.c +++ b/libgfortran/generated/spread_i4.c @@ -69,6 +69,9 @@ spread_i4 (gfc_array_i4 *ret, const gfc_array_i4 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_i4 (gfc_array_i4 *ret, const gfc_array_i4 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_i4 (gfc_array_i4 *ret, const gfc_array_i4 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_i4 (gfc_array_i4 *ret, const gfc_array_i4 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_i4 (gfc_array_i4 *ret, const gfc_array_i4 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_i4 (gfc_array_i4 *ret, const gfc_array_i4 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_i4 (gfc_array_i4 *ret, const GFC_INTEGER_4 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_INTEGER_4)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_i8.c b/libgfortran/generated/spread_i8.c index 6b10a81..2931263 100644 --- a/libgfortran/generated/spread_i8.c +++ b/libgfortran/generated/spread_i8.c @@ -69,6 +69,9 @@ spread_i8 (gfc_array_i8 *ret, const gfc_array_i8 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_i8 (gfc_array_i8 *ret, const gfc_array_i8 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_i8 (gfc_array_i8 *ret, const gfc_array_i8 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_i8 (gfc_array_i8 *ret, const gfc_array_i8 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_i8 (gfc_array_i8 *ret, const gfc_array_i8 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_i8 (gfc_array_i8 *ret, const gfc_array_i8 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_i8 (gfc_array_i8 *ret, const GFC_INTEGER_8 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_INTEGER_8)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_r10.c b/libgfortran/generated/spread_r10.c index 9a3a356..3c3f197 100644 --- a/libgfortran/generated/spread_r10.c +++ b/libgfortran/generated/spread_r10.c @@ -69,6 +69,9 @@ spread_r10 (gfc_array_r10 *ret, const gfc_array_r10 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_r10 (gfc_array_r10 *ret, const gfc_array_r10 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_r10 (gfc_array_r10 *ret, const gfc_array_r10 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_r10 (gfc_array_r10 *ret, const gfc_array_r10 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_r10 (gfc_array_r10 *ret, const gfc_array_r10 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_r10 (gfc_array_r10 *ret, const gfc_array_r10 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_r10 (gfc_array_r10 *ret, const GFC_REAL_10 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_REAL_10)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_r16.c b/libgfortran/generated/spread_r16.c index 69ab4c6..1316260 100644 --- a/libgfortran/generated/spread_r16.c +++ b/libgfortran/generated/spread_r16.c @@ -69,6 +69,9 @@ spread_r16 (gfc_array_r16 *ret, const gfc_array_r16 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_r16 (gfc_array_r16 *ret, const gfc_array_r16 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_r16 (gfc_array_r16 *ret, const gfc_array_r16 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_r16 (gfc_array_r16 *ret, const gfc_array_r16 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_r16 (gfc_array_r16 *ret, const gfc_array_r16 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_r16 (gfc_array_r16 *ret, const gfc_array_r16 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_r16 (gfc_array_r16 *ret, const GFC_REAL_16 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_REAL_16)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_r4.c b/libgfortran/generated/spread_r4.c index 6f018de..cc0f119 100644 --- a/libgfortran/generated/spread_r4.c +++ b/libgfortran/generated/spread_r4.c @@ -69,6 +69,9 @@ spread_r4 (gfc_array_r4 *ret, const gfc_array_r4 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_r4 (gfc_array_r4 *ret, const gfc_array_r4 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_r4 (gfc_array_r4 *ret, const gfc_array_r4 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_r4 (gfc_array_r4 *ret, const gfc_array_r4 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_r4 (gfc_array_r4 *ret, const gfc_array_r4 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_r4 (gfc_array_r4 *ret, const gfc_array_r4 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_r4 (gfc_array_r4 *ret, const GFC_REAL_4 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_REAL_4)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/spread_r8.c b/libgfortran/generated/spread_r8.c index d05e31a..f38ef38 100644 --- a/libgfortran/generated/spread_r8.c +++ b/libgfortran/generated/spread_r8.c @@ -69,6 +69,9 @@ spread_r8 (gfc_array_r8 *ret, const gfc_array_r8 *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -76,26 +79,25 @@ spread_r8 (gfc_array_r8 *ret, const gfc_array_r8 *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -122,10 +124,10 @@ spread_r8 (gfc_array_r8 *ret, const gfc_array_r8 *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -136,8 +138,7 @@ spread_r8 (gfc_array_r8 *ret, const gfc_array_r8 *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -147,8 +148,8 @@ spread_r8 (gfc_array_r8 *ret, const gfc_array_r8 *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -159,17 +160,16 @@ spread_r8 (gfc_array_r8 *ret, const gfc_array_r8 *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -248,19 +248,17 @@ spread_scalar_r8 (gfc_array_r8 *ret, const GFC_REAL_8 *source, { ret->data = internal_malloc_size (ncopies * sizeof (GFC_REAL_8)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/generated/sum_c10.c b/libgfortran/generated/sum_c10.c index a1f658e..c63bc69 100644 --- a/libgfortran/generated/sum_c10.c +++ b/libgfortran/generated/sum_c10.c @@ -57,24 +57,23 @@ sum_c10 (gfc_array_c10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_c10 (gfc_array_c10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_c10 (gfc_array_c10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_c10 (gfc_array_c10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_c10 (gfc_array_c10 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_c10 (gfc_array_c10 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_c10 (gfc_array_c10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_COMPLEX_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_c10 (gfc_array_c10 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_c10 (gfc_array_c10 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_c10 (gfc_array_c10 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_c10 (gfc_array_c10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_c10 (gfc_array_c10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_c10 (gfc_array_c10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_c16.c b/libgfortran/generated/sum_c16.c index 8ec03a2..9871d2d 100644 --- a/libgfortran/generated/sum_c16.c +++ b/libgfortran/generated/sum_c16.c @@ -57,24 +57,23 @@ sum_c16 (gfc_array_c16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_c16 (gfc_array_c16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_c16 (gfc_array_c16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_c16 (gfc_array_c16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_c16 (gfc_array_c16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_c16 (gfc_array_c16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_c16 (gfc_array_c16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_COMPLEX_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_c16 (gfc_array_c16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_c16 (gfc_array_c16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_c16 (gfc_array_c16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_c16 (gfc_array_c16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_c16 (gfc_array_c16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_c16 (gfc_array_c16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_c4.c b/libgfortran/generated/sum_c4.c index 158e302..920a6fb 100644 --- a/libgfortran/generated/sum_c4.c +++ b/libgfortran/generated/sum_c4.c @@ -57,24 +57,23 @@ sum_c4 (gfc_array_c4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_c4 (gfc_array_c4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_c4 (gfc_array_c4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_c4 (gfc_array_c4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_c4 (gfc_array_c4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_c4 (gfc_array_c4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_c4 (gfc_array_c4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_COMPLEX_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_c4 (gfc_array_c4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_c4 (gfc_array_c4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_c4 (gfc_array_c4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_c4 (gfc_array_c4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_c4 (gfc_array_c4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_c4 (gfc_array_c4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_c8.c b/libgfortran/generated/sum_c8.c index bc9dc49..c3e7923 100644 --- a/libgfortran/generated/sum_c8.c +++ b/libgfortran/generated/sum_c8.c @@ -57,24 +57,23 @@ sum_c8 (gfc_array_c8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_c8 (gfc_array_c8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_c8 (gfc_array_c8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_c8 (gfc_array_c8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_c8 (gfc_array_c8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_c8 (gfc_array_c8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_c8 (gfc_array_c8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_COMPLEX_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_c8 (gfc_array_c8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_c8 (gfc_array_c8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_c8 (gfc_array_c8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_c8 (gfc_array_c8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_c8 (gfc_array_c8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_c8 (gfc_array_c8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_i1.c b/libgfortran/generated/sum_i1.c index 34bbde2..913d732 100644 --- a/libgfortran/generated/sum_i1.c +++ b/libgfortran/generated/sum_i1.c @@ -57,24 +57,23 @@ sum_i1 (gfc_array_i1 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_i1 (gfc_array_i1 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_i1 (gfc_array_i1 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_i1 (gfc_array_i1 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_i1 (gfc_array_i1 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_i1 (gfc_array_i1 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_i1 (gfc_array_i1 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_i1 (gfc_array_i1 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_i16.c b/libgfortran/generated/sum_i16.c index 1c7d6d9..060d45a 100644 --- a/libgfortran/generated/sum_i16.c +++ b/libgfortran/generated/sum_i16.c @@ -57,24 +57,23 @@ sum_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_i16 (gfc_array_i16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_i16 (gfc_array_i16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_i16 (gfc_array_i16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_i16 (gfc_array_i16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_i16 (gfc_array_i16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_i16 (gfc_array_i16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_i16 (gfc_array_i16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_i2.c b/libgfortran/generated/sum_i2.c index ffa9846..5318283 100644 --- a/libgfortran/generated/sum_i2.c +++ b/libgfortran/generated/sum_i2.c @@ -57,24 +57,23 @@ sum_i2 (gfc_array_i2 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_i2 (gfc_array_i2 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_i2 (gfc_array_i2 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_i2 (gfc_array_i2 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_i2 (gfc_array_i2 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_i2 (gfc_array_i2 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_i2 (gfc_array_i2 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_i2 (gfc_array_i2 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_i4.c b/libgfortran/generated/sum_i4.c index c91cad0..e8c60c3 100644 --- a/libgfortran/generated/sum_i4.c +++ b/libgfortran/generated/sum_i4.c @@ -57,24 +57,23 @@ sum_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_i4 (gfc_array_i4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_i4 (gfc_array_i4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_i4 (gfc_array_i4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_i4 (gfc_array_i4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_i4 (gfc_array_i4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_i4 (gfc_array_i4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_i4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_i8.c b/libgfortran/generated/sum_i8.c index de800b2..9ee3e93 100644 --- a/libgfortran/generated/sum_i8.c +++ b/libgfortran/generated/sum_i8.c @@ -57,24 +57,23 @@ sum_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_i8 (gfc_array_i8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_i8 (gfc_array_i8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_i8 (gfc_array_i8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_i8 (gfc_array_i8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_i8 (gfc_array_i8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_i8 (gfc_array_i8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_i8 (gfc_array_i8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_r10.c b/libgfortran/generated/sum_r10.c index 5039e62..6a28304 100644 --- a/libgfortran/generated/sum_r10.c +++ b/libgfortran/generated/sum_r10.c @@ -57,24 +57,23 @@ sum_r10 (gfc_array_r10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_r10 (gfc_array_r10 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_r10 (gfc_array_r10 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_r10 (gfc_array_r10 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_r10 (gfc_array_r10 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_r10 (gfc_array_r10 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_r10 (gfc_array_r10 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_r10 (gfc_array_r10 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_r16.c b/libgfortran/generated/sum_r16.c index 070e095..35296c1 100644 --- a/libgfortran/generated/sum_r16.c +++ b/libgfortran/generated/sum_r16.c @@ -57,24 +57,23 @@ sum_r16 (gfc_array_r16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_r16 (gfc_array_r16 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_r16 (gfc_array_r16 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_r16 (gfc_array_r16 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_r16 (gfc_array_r16 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_r16 (gfc_array_r16 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_r16 (gfc_array_r16 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_r16 (gfc_array_r16 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_r4.c b/libgfortran/generated/sum_r4.c index 24e427a..e7e2fe3 100644 --- a/libgfortran/generated/sum_r4.c +++ b/libgfortran/generated/sum_r4.c @@ -57,24 +57,23 @@ sum_r4 (gfc_array_r4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_r4 (gfc_array_r4 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_r4 (gfc_array_r4 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_r4 (gfc_array_r4 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_r4 (gfc_array_r4 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_r4 (gfc_array_r4 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_r4 (gfc_array_r4 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_r4 (gfc_array_r4 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/sum_r8.c b/libgfortran/generated/sum_r8.c index cb86155..86ae109 100644 --- a/libgfortran/generated/sum_r8.c +++ b/libgfortran/generated/sum_r8.c @@ -57,24 +57,23 @@ sum_r8 (gfc_array_r8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -82,30 +81,31 @@ sum_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -124,8 +124,7 @@ sum_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -138,7 +137,7 @@ sum_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -229,7 +228,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -246,14 +245,14 @@ msum_r8 (gfc_array_r8 * const restrict retarray, else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -261,10 +260,9 @@ msum_r8 (gfc_array_r8 * const restrict retarray, } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -272,19 +270,20 @@ msum_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -293,8 +292,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray, if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -312,8 +310,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -324,8 +321,8 @@ msum_r8 (gfc_array_r8 * const restrict retarray, { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " SUM intrinsic in dimension %ld:" @@ -338,7 +335,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -436,8 +433,8 @@ ssum_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -445,9 +442,9 @@ ssum_r8 (gfc_array_r8 * const restrict retarray, for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -455,29 +452,29 @@ ssum_r8 (gfc_array_r8 * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * retarray->dim[rank-1].stride + alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -497,8 +494,7 @@ ssum_r8 (gfc_array_r8 * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " SUM intrinsic in dimension %ld:" @@ -511,7 +507,7 @@ ssum_r8 (gfc_array_r8 * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/generated/transpose_c10.c b/libgfortran/generated/transpose_c10.c index 338998b..e740d12 100644 --- a/libgfortran/generated/transpose_c10.c +++ b/libgfortran/generated/transpose_c10.c @@ -54,13 +54,11 @@ transpose_c10 (gfc_array_c10 * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) ret)); ret->offset = 0; @@ -68,8 +66,8 @@ transpose_c10 (gfc_array_c10 * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -77,8 +75,8 @@ transpose_c10 (gfc_array_c10 * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -88,13 +86,13 @@ transpose_c10 (gfc_array_c10 * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/generated/transpose_c16.c b/libgfortran/generated/transpose_c16.c index 2ce91c7..31115bd 100644 --- a/libgfortran/generated/transpose_c16.c +++ b/libgfortran/generated/transpose_c16.c @@ -54,13 +54,11 @@ transpose_c16 (gfc_array_c16 * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) ret)); ret->offset = 0; @@ -68,8 +66,8 @@ transpose_c16 (gfc_array_c16 * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -77,8 +75,8 @@ transpose_c16 (gfc_array_c16 * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -88,13 +86,13 @@ transpose_c16 (gfc_array_c16 * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/generated/transpose_c4.c b/libgfortran/generated/transpose_c4.c index 1aa9803..a63f62c 100644 --- a/libgfortran/generated/transpose_c4.c +++ b/libgfortran/generated/transpose_c4.c @@ -54,13 +54,11 @@ transpose_c4 (gfc_array_c4 * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) ret)); ret->offset = 0; @@ -68,8 +66,8 @@ transpose_c4 (gfc_array_c4 * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -77,8 +75,8 @@ transpose_c4 (gfc_array_c4 * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -88,13 +86,13 @@ transpose_c4 (gfc_array_c4 * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/generated/transpose_c8.c b/libgfortran/generated/transpose_c8.c index e901fcb..8322394 100644 --- a/libgfortran/generated/transpose_c8.c +++ b/libgfortran/generated/transpose_c8.c @@ -54,13 +54,11 @@ transpose_c8 (gfc_array_c8 * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) ret)); ret->offset = 0; @@ -68,8 +66,8 @@ transpose_c8 (gfc_array_c8 * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -77,8 +75,8 @@ transpose_c8 (gfc_array_c8 * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -88,13 +86,13 @@ transpose_c8 (gfc_array_c8 * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/generated/transpose_i16.c b/libgfortran/generated/transpose_i16.c index d61155d..f8cfd82 100644 --- a/libgfortran/generated/transpose_i16.c +++ b/libgfortran/generated/transpose_i16.c @@ -54,13 +54,11 @@ transpose_i16 (gfc_array_i16 * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * size0 ((array_t *) ret)); ret->offset = 0; @@ -68,8 +66,8 @@ transpose_i16 (gfc_array_i16 * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -77,8 +75,8 @@ transpose_i16 (gfc_array_i16 * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -88,13 +86,13 @@ transpose_i16 (gfc_array_i16 * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/generated/transpose_i4.c b/libgfortran/generated/transpose_i4.c index f835a39..9b15e47 100644 --- a/libgfortran/generated/transpose_i4.c +++ b/libgfortran/generated/transpose_i4.c @@ -54,13 +54,11 @@ transpose_i4 (gfc_array_i4 * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * size0 ((array_t *) ret)); ret->offset = 0; @@ -68,8 +66,8 @@ transpose_i4 (gfc_array_i4 * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -77,8 +75,8 @@ transpose_i4 (gfc_array_i4 * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -88,13 +86,13 @@ transpose_i4 (gfc_array_i4 * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/generated/transpose_i8.c b/libgfortran/generated/transpose_i8.c index a6b6333..ddf772b 100644 --- a/libgfortran/generated/transpose_i8.c +++ b/libgfortran/generated/transpose_i8.c @@ -54,13 +54,11 @@ transpose_i8 (gfc_array_i8 * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * size0 ((array_t *) ret)); ret->offset = 0; @@ -68,8 +66,8 @@ transpose_i8 (gfc_array_i8 * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -77,8 +75,8 @@ transpose_i8 (gfc_array_i8 * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -88,13 +86,13 @@ transpose_i8 (gfc_array_i8 * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/generated/transpose_r10.c b/libgfortran/generated/transpose_r10.c index c58ffa2..2b2e02d 100644 --- a/libgfortran/generated/transpose_r10.c +++ b/libgfortran/generated/transpose_r10.c @@ -54,13 +54,11 @@ transpose_r10 (gfc_array_r10 * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof (GFC_REAL_10) * size0 ((array_t *) ret)); ret->offset = 0; @@ -68,8 +66,8 @@ transpose_r10 (gfc_array_r10 * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -77,8 +75,8 @@ transpose_r10 (gfc_array_r10 * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -88,13 +86,13 @@ transpose_r10 (gfc_array_r10 * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/generated/transpose_r16.c b/libgfortran/generated/transpose_r16.c index 5b5915e..4d2e406 100644 --- a/libgfortran/generated/transpose_r16.c +++ b/libgfortran/generated/transpose_r16.c @@ -54,13 +54,11 @@ transpose_r16 (gfc_array_r16 * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof (GFC_REAL_16) * size0 ((array_t *) ret)); ret->offset = 0; @@ -68,8 +66,8 @@ transpose_r16 (gfc_array_r16 * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -77,8 +75,8 @@ transpose_r16 (gfc_array_r16 * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -88,13 +86,13 @@ transpose_r16 (gfc_array_r16 * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/generated/transpose_r4.c b/libgfortran/generated/transpose_r4.c index 6cff009..1748c1d 100644 --- a/libgfortran/generated/transpose_r4.c +++ b/libgfortran/generated/transpose_r4.c @@ -54,13 +54,11 @@ transpose_r4 (gfc_array_r4 * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof (GFC_REAL_4) * size0 ((array_t *) ret)); ret->offset = 0; @@ -68,8 +66,8 @@ transpose_r4 (gfc_array_r4 * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -77,8 +75,8 @@ transpose_r4 (gfc_array_r4 * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -88,13 +86,13 @@ transpose_r4 (gfc_array_r4 * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/generated/transpose_r8.c b/libgfortran/generated/transpose_r8.c index e66a32c..09054b61 100644 --- a/libgfortran/generated/transpose_r8.c +++ b/libgfortran/generated/transpose_r8.c @@ -54,13 +54,11 @@ transpose_r8 (gfc_array_r8 * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof (GFC_REAL_8) * size0 ((array_t *) ret)); ret->offset = 0; @@ -68,8 +66,8 @@ transpose_r8 (gfc_array_r8 * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -77,8 +75,8 @@ transpose_r8 (gfc_array_r8 * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -88,13 +86,13 @@ transpose_r8 (gfc_array_r8 * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/generated/unpack_c10.c b/libgfortran/generated/unpack_c10.c index 91ba772..9b89a5b 100644 --- a/libgfortran/generated/unpack_c10.c +++ b/libgfortran/generated/unpack_c10.c @@ -90,13 +90,12 @@ unpack0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_c16.c b/libgfortran/generated/unpack_c16.c index 0df76e4..2d9931f 100644 --- a/libgfortran/generated/unpack_c16.c +++ b/libgfortran/generated/unpack_c16.c @@ -90,13 +90,12 @@ unpack0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_c4.c b/libgfortran/generated/unpack_c4.c index f112388..116f213 100644 --- a/libgfortran/generated/unpack_c4.c +++ b/libgfortran/generated/unpack_c4.c @@ -90,13 +90,12 @@ unpack0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_c8.c b/libgfortran/generated/unpack_c8.c index 118f2b6..7298eec 100644 --- a/libgfortran/generated/unpack_c8.c +++ b/libgfortran/generated/unpack_c8.c @@ -90,13 +90,12 @@ unpack0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_i1.c b/libgfortran/generated/unpack_i1.c index 974fc31..f5dcb93 100644 --- a/libgfortran/generated/unpack_i1.c +++ b/libgfortran/generated/unpack_i1.c @@ -90,13 +90,12 @@ unpack0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_i16.c b/libgfortran/generated/unpack_i16.c index fb1ee8f..77920ea 100644 --- a/libgfortran/generated/unpack_i16.c +++ b/libgfortran/generated/unpack_i16.c @@ -90,13 +90,12 @@ unpack0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_i2.c b/libgfortran/generated/unpack_i2.c index ecb4672..c7257bb 100644 --- a/libgfortran/generated/unpack_i2.c +++ b/libgfortran/generated/unpack_i2.c @@ -90,13 +90,12 @@ unpack0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_i4.c b/libgfortran/generated/unpack_i4.c index cd16e57..e3cdde6 100644 --- a/libgfortran/generated/unpack_i4.c +++ b/libgfortran/generated/unpack_i4.c @@ -90,13 +90,12 @@ unpack0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_i8.c b/libgfortran/generated/unpack_i8.c index 422a11c..2f72064 100644 --- a/libgfortran/generated/unpack_i8.c +++ b/libgfortran/generated/unpack_i8.c @@ -90,13 +90,12 @@ unpack0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_r10.c b/libgfortran/generated/unpack_r10.c index 7903a3c..796df2e 100644 --- a/libgfortran/generated/unpack_r10.c +++ b/libgfortran/generated/unpack_r10.c @@ -90,13 +90,12 @@ unpack0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_r16.c b/libgfortran/generated/unpack_r16.c index d84ccca..b25d286 100644 --- a/libgfortran/generated/unpack_r16.c +++ b/libgfortran/generated/unpack_r16.c @@ -90,13 +90,12 @@ unpack0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_r4.c b/libgfortran/generated/unpack_r4.c index 130acbf..f4b763f 100644 --- a/libgfortran/generated/unpack_r4.c +++ b/libgfortran/generated/unpack_r4.c @@ -90,13 +90,12 @@ unpack0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/generated/unpack_r8.c b/libgfortran/generated/unpack_r8.c index fa80955..dc9b4d3 100644 --- a/libgfortran/generated/unpack_r8.c +++ b/libgfortran/generated/unpack_r8.c @@ -90,13 +90,12 @@ unpack0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -108,10 +107,10 @@ unpack0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -123,7 +122,7 @@ unpack0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -235,14 +234,13 @@ unpack1_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -254,11 +252,11 @@ unpack1_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -272,7 +270,7 @@ unpack1_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/intrinsics/associated.c b/libgfortran/intrinsics/associated.c index 87b449e..0aade1d 100644 --- a/libgfortran/intrinsics/associated.c +++ b/libgfortran/intrinsics/associated.c @@ -43,14 +43,14 @@ associated (const gfc_array_void *pointer, const gfc_array_void *target) rank = GFC_DESCRIPTOR_RANK (pointer); for (n = 0; n < rank; n++) { - long diff; - diff = pointer->dim[n].ubound - pointer->dim[n].lbound; + long extent; + extent = GFC_DESCRIPTOR_EXTENT(pointer,n); - if (diff != (target->dim[n].ubound - target->dim[n].lbound)) + if (extent != GFC_DESCRIPTOR_EXTENT(target,n)) return 0; - if (pointer->dim[n].stride != target->dim[n].stride && diff != 0) + if (GFC_DESCRIPTOR_STRIDE(pointer,n) != GFC_DESCRIPTOR_STRIDE(target,n) && extent != 1) return 0; - if (pointer->dim[n].ubound < pointer->dim[n].lbound) + if (extent <= 0) return 0; } diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c index be0444a..1b7dbc1c 100644 --- a/libgfortran/intrinsics/cshift0.c +++ b/libgfortran/intrinsics/cshift0.c @@ -1,5 +1,5 @@ /* Generic implementation of the CSHIFT intrinsic - Copyright 2003, 2005, 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright 2003, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Feng Wang <wf_cs@yahoo.com> This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -7,21 +7,26 @@ This file is part of the GNU Fortran 95 runtime library (libgfortran). Libgfortran is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either -version 3 of the License, or (at your option) any later version. +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) Libgfortran is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -<http://www.gnu.org/licenses/>. */ +You should have received a copy of the GNU General Public +License along with libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ #include "libgfortran.h" #include <stdlib.h> @@ -30,7 +35,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see static void cshift0 (gfc_array_char * ret, const gfc_array_char * array, - index_type shift, int which, index_type size) + ssize_t shift, int which, index_type size) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -66,14 +71,17 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) - * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) * + GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } if (arraysize > 0) @@ -278,20 +286,20 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); n++; } } @@ -306,7 +314,7 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array, rptr = ret->data; sptr = array->data; - shift = len == 0 ? 0 : shift % len; + shift = len == 0 ? 0 : shift % (ssize_t)len; if (shift < 0) shift += len; diff --git a/libgfortran/intrinsics/date_and_time.c b/libgfortran/intrinsics/date_and_time.c index be64626..4bc6e69 100644 --- a/libgfortran/intrinsics/date_and_time.c +++ b/libgfortran/intrinsics/date_and_time.c @@ -265,8 +265,8 @@ date_and_time (char *__date, char *__time, char *__zone, index_type len, delta, elt_size; elt_size = GFC_DESCRIPTOR_SIZE (__values); - len = __values->dim[0].ubound + 1 - __values->dim[0].lbound; - delta = __values->dim[0].stride; + len = GFC_DESCRIPTOR_EXTENT(__values,0); + delta = GFC_DESCRIPTOR_STRIDE(__values,0); if (delta == 0) delta = 1; @@ -351,9 +351,7 @@ secnds (GFC_REAL_4 *x) & GFC_DTYPE_TYPE_MASK) + (4 << GFC_DTYPE_SIZE_SHIFT); - avalues->dim[0].ubound = 7; - avalues->dim[0].lbound = 0; - avalues->dim[0].stride = 1; + GFC_DIMENSION_SET(avalues->dim[0], 0, 7, 1); date_and_time (NULL, NULL, NULL, avalues, 0, 0, 0); @@ -411,9 +409,9 @@ itime_i4 (gfc_array_i4 *__values) itime0(x); /* Copy the value into the array. */ - len = __values->dim[0].ubound + 1 - __values->dim[0].lbound; + len = GFC_DESCRIPTOR_EXTENT(__values,0); assert (len >= 3); - delta = __values->dim[0].stride; + delta = GFC_DESCRIPTOR_STRIDE(__values,0); if (delta == 0) delta = 1; @@ -437,9 +435,9 @@ itime_i8 (gfc_array_i8 *__values) itime0(x); /* Copy the value into the array. */ - len = __values->dim[0].ubound + 1 - __values->dim[0].lbound; + len = GFC_DESCRIPTOR_EXTENT(__values,0); assert (len >= 3); - delta = __values->dim[0].stride; + delta = GFC_DESCRIPTOR_STRIDE(__values,0); if (delta == 0) delta = 1; @@ -493,9 +491,9 @@ idate_i4 (gfc_array_i4 *__values) idate0(x); /* Copy the value into the array. */ - len = __values->dim[0].ubound + 1 - __values->dim[0].lbound; + len = GFC_DESCRIPTOR_EXTENT(__values,0); assert (len >= 3); - delta = __values->dim[0].stride; + delta = GFC_DESCRIPTOR_STRIDE(__values,0); if (delta == 0) delta = 1; @@ -519,9 +517,9 @@ idate_i8 (gfc_array_i8 *__values) idate0(x); /* Copy the value into the array. */ - len = __values->dim[0].ubound + 1 - __values->dim[0].lbound; + len = GFC_DESCRIPTOR_EXTENT(__values,0); assert (len >= 3); - delta = __values->dim[0].stride; + delta = GFC_DESCRIPTOR_STRIDE(__values,0); if (delta == 0) delta = 1; @@ -583,9 +581,9 @@ gmtime_i4 (GFC_INTEGER_4 * t, gfc_array_i4 * tarray) gmtime_0(&tt, x); /* Copy the values into the array. */ - len = tarray->dim[0].ubound + 1 - tarray->dim[0].lbound; + len = GFC_DESCRIPTOR_EXTENT(tarray,0); assert (len >= 9); - delta = tarray->dim[0].stride; + delta = GFC_DESCRIPTOR_STRIDE(tarray,0); if (delta == 0) delta = 1; @@ -610,9 +608,9 @@ gmtime_i8 (GFC_INTEGER_8 * t, gfc_array_i8 * tarray) gmtime_0(&tt, x); /* Copy the values into the array. */ - len = tarray->dim[0].ubound + 1 - tarray->dim[0].lbound; + len = GFC_DESCRIPTOR_EXTENT(tarray,0); assert (len >= 9); - delta = tarray->dim[0].stride; + delta = GFC_DESCRIPTOR_STRIDE(tarray,0); if (delta == 0) delta = 1; @@ -675,9 +673,9 @@ ltime_i4 (GFC_INTEGER_4 * t, gfc_array_i4 * tarray) ltime_0(&tt, x); /* Copy the values into the array. */ - len = tarray->dim[0].ubound + 1 - tarray->dim[0].lbound; + len = GFC_DESCRIPTOR_EXTENT(tarray,0); assert (len >= 9); - delta = tarray->dim[0].stride; + delta = GFC_DESCRIPTOR_STRIDE(tarray,0); if (delta == 0) delta = 1; @@ -702,9 +700,9 @@ ltime_i8 (GFC_INTEGER_8 * t, gfc_array_i8 * tarray) ltime_0(&tt, x); /* Copy the values into the array. */ - len = tarray->dim[0].ubound + 1 - tarray->dim[0].lbound; + len = GFC_DESCRIPTOR_EXTENT(tarray,0); assert (len >= 9); - delta = tarray->dim[0].stride; + delta = GFC_DESCRIPTOR_STRIDE(tarray,0); if (delta == 0) delta = 1; diff --git a/libgfortran/intrinsics/dtime.c b/libgfortran/intrinsics/dtime.c index 40028a6..4b7000b 100644 --- a/libgfortran/intrinsics/dtime.c +++ b/libgfortran/intrinsics/dtime.c @@ -42,7 +42,7 @@ dtime_sub (gfc_array_r4 *t, GFC_REAL_4 *result) GFC_REAL_4 *tp; long user_sec, user_usec, system_sec, system_usec; - if (((t->dim[0].ubound + 1 - t->dim[0].lbound)) < 2) + if (((GFC_DESCRIPTOR_EXTENT(t,0))) < 2) runtime_error ("Insufficient number of elements in TARRAY."); __gthread_mutex_lock (&dtime_update_lock); @@ -62,7 +62,7 @@ dtime_sub (gfc_array_r4 *t, GFC_REAL_4 *result) tp = t->data; *tp = tu; - tp += t->dim[0].stride; + tp += GFC_DESCRIPTOR_STRIDE(t,0); *tp = ts; *result = tt; __gthread_mutex_unlock (&dtime_update_lock); diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c index 6ac7c94..4b8082f 100644 --- a/libgfortran/intrinsics/eoshift0.c +++ b/libgfortran/intrinsics/eoshift0.c @@ -70,13 +70,18 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) + * GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + } } else @@ -96,20 +101,20 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); n++; } } diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c index 763545a..aa5ef5a 100644 --- a/libgfortran/intrinsics/eoshift2.c +++ b/libgfortran/intrinsics/eoshift2.c @@ -34,7 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see static void eoshift2 (gfc_array_char *ret, const gfc_array_char *array, int shift, const gfc_array_char *bound, int which, - index_type size, const char *filler, index_type filler_len) + const char *filler, index_type filler_len) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -59,6 +59,7 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array, index_type len; index_type n; index_type arraysize; + index_type size; /* The compiler cannot figure out that these are set, initialize them to avoid warnings. */ @@ -66,6 +67,8 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array, soffset = 0; roffset = 0; + size = GFC_DESCRIPTOR_SIZE (array); + arraysize = size0 ((array_t *) array); if (ret->data == NULL) @@ -77,13 +80,18 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) + * GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + } } else @@ -107,22 +115,22 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (bound) - bstride[n] = bound->dim[n].stride * size; + bstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(bound,n); else bstride[n] = 0; n++; @@ -256,7 +264,7 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array, const GFC_INTEGER_##N *pdim) \ { \ eoshift2 (ret, array, *pshift, pbound, pdim ? *pdim : 1, \ - GFC_DESCRIPTOR_SIZE (array), "\0", 1); \ + "\0", 1); \ } \ \ extern void eoshift2_##N##_char (gfc_array_char *, GFC_INTEGER_4, \ @@ -274,11 +282,11 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array, const GFC_INTEGER_##N *pshift, \ const gfc_array_char *pbound, \ const GFC_INTEGER_##N *pdim, \ - GFC_INTEGER_4 array_length, \ + GFC_INTEGER_4 array_length __attribute__((unused)), \ GFC_INTEGER_4 bound_length __attribute__((unused))) \ { \ eoshift2 (ret, array, *pshift, pbound, pdim ? *pdim : 1, \ - array_length, " ", 1); \ + " ", 1); \ } \ \ extern void eoshift2_##N##_char4 (gfc_array_char *, GFC_INTEGER_4, \ @@ -296,12 +304,12 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array, const GFC_INTEGER_##N *pshift, \ const gfc_array_char *pbound, \ const GFC_INTEGER_##N *pdim, \ - GFC_INTEGER_4 array_length, \ + GFC_INTEGER_4 array_length __attribute__((unused)), \ GFC_INTEGER_4 bound_length __attribute__((unused))) \ { \ static const gfc_char4_t space = (unsigned char) ' '; \ eoshift2 (ret, array, *pshift, pbound, pdim ? *pdim : 1, \ - array_length * sizeof (gfc_char4_t), (const char *) &space, \ + (const char *) &space, \ sizeof (gfc_char4_t)); \ } diff --git a/libgfortran/intrinsics/etime.c b/libgfortran/intrinsics/etime.c index 1ae357e..b0fd742 100644 --- a/libgfortran/intrinsics/etime.c +++ b/libgfortran/intrinsics/etime.c @@ -35,7 +35,7 @@ etime_sub (gfc_array_r4 *t, GFC_REAL_4 *result) GFC_REAL_4 tu, ts, tt, *tp; long user_sec, user_usec, system_sec, system_usec; - if (((t->dim[0].ubound + 1 - t->dim[0].lbound)) < 2) + if (((GFC_DESCRIPTOR_EXTENT(t,0))) < 2) runtime_error ("Insufficient number of elements in TARRAY."); if (__time_1 (&user_sec, &user_usec, &system_sec, &system_usec) == 0) @@ -54,7 +54,7 @@ etime_sub (gfc_array_r4 *t, GFC_REAL_4 *result) tp = t->data; *tp = tu; - tp += t->dim[0].stride; + tp += GFC_DESCRIPTOR_STRIDE(t,0); *tp = ts; *result = tt; } diff --git a/libgfortran/intrinsics/iso_c_binding.c b/libgfortran/intrinsics/iso_c_binding.c index 38f0775..bb25e3e 100644 --- a/libgfortran/intrinsics/iso_c_binding.c +++ b/libgfortran/intrinsics/iso_c_binding.c @@ -75,9 +75,8 @@ ISO_C_BINDING_PREFIX (c_f_pointer) (void *c_ptr_in, /* A generic function to set the common fields of all descriptors, no - matter whether it's to a scalar or an array. Fields set are: data, - and if appropriate, rank, offset, dim[*].lbound, dim[*].ubound, and - dim[*].stride. Parameter shape is a rank 1 array of integers + matter whether it's to a scalar or an array. Access is via the array + descrptor macros. Parameter shape is a rank 1 array of integers containing the upper bound of each dimension of what f_ptr_out points to. The length of this array must be EXACTLY the rank of what f_ptr_out points to, as required by the draft (J3/04-007). If @@ -104,51 +103,51 @@ ISO_C_BINDING_PREFIX (c_f_pointer_u0) (void *c_ptr_in, p = shape->data; size = GFC_DESCRIPTOR_SIZE(shape); - source_stride = shape->dim[0].stride * size; + source_stride = GFC_DESCRIPTOR_STRIDE_BYTES(shape,0); /* shape's length (rank of the output array) */ - shapeSize = shape->dim[0].ubound + 1 - shape->dim[0].lbound; + shapeSize = GFC_DESCRIPTOR_EXTENT(shape,0); for (i = 0; i < shapeSize; i++) { - /* Lower bound is 1, as specified by the draft. */ - f_ptr_out->dim[i].lbound = 1; + index_type str, ub; + /* Have to allow for the SHAPE array to be any valid kind for an INTEGER type. */ #ifdef HAVE_GFC_INTEGER_1 if (size == 1) - f_ptr_out->dim[i].ubound = *((GFC_INTEGER_1 *) p); + ub = *((GFC_INTEGER_1 *) p); #endif #ifdef HAVE_GFC_INTEGER_2 if (size == 2) - f_ptr_out->dim[i].ubound = *((GFC_INTEGER_2 *) p); + ub = *((GFC_INTEGER_2 *) p); #endif #ifdef HAVE_GFC_INTEGER_4 if (size == 4) - f_ptr_out->dim[i].ubound = *((GFC_INTEGER_4 *) p); + ub = *((GFC_INTEGER_4 *) p); #endif #ifdef HAVE_GFC_INTEGER_8 if (size == 8) - f_ptr_out->dim[i].ubound = *((GFC_INTEGER_8 *) p); + ub = *((GFC_INTEGER_8 *) p); #endif #ifdef HAVE_GFC_INTEGER_16 if (size == 16) - f_ptr_out->dim[i].ubound = *((GFC_INTEGER_16 *) p); + ub = *((GFC_INTEGER_16 *) p); #endif p += source_stride; if (i == 0) { - f_ptr_out->dim[0].stride = 1; - f_ptr_out->offset = f_ptr_out->dim[0].lbound - * f_ptr_out->dim[0].stride; + str = 1; + f_ptr_out->offset = str; } else { - f_ptr_out->dim[i].stride = (f_ptr_out->dim[i-1].ubound + 1) - - f_ptr_out->dim[i-1].lbound; - f_ptr_out->offset += f_ptr_out->dim[i].lbound - * f_ptr_out->dim[i].stride; + str = GFC_DESCRIPTOR_EXTENT(f_ptr_out,i-1); + f_ptr_out->offset += str; } + + /* Lower bound is 1, as specified by the draft. */ + GFC_DIMENSION_SET(f_ptr_out->dim[i], 1, ub, str); } f_ptr_out->offset *= -1; diff --git a/libgfortran/intrinsics/move_alloc.c b/libgfortran/intrinsics/move_alloc.c index 527aa6f..9b5497c 100644 --- a/libgfortran/intrinsics/move_alloc.c +++ b/libgfortran/intrinsics/move_alloc.c @@ -42,11 +42,11 @@ move_alloc (gfc_array_char * from, gfc_array_char * to) for (i = 0; i < GFC_DESCRIPTOR_RANK (from); i++) { - to->dim[i].lbound = from->dim[i].lbound; - to->dim[i].ubound = from->dim[i].ubound; - to->dim[i].stride = from->dim[i].stride; - from->dim[i].stride = 0; - from->dim[i].ubound = from->dim[i].lbound; + GFC_DIMENSION_SET(to->dim[i],GFC_DESCRIPTOR_LBOUND(from,i), + GFC_DESCRIPTOR_UBOUND(from,i), + GFC_DESCRIPTOR_STRIDE(from,i)); + GFC_DIMENSION_SET(from->dim[i],GFC_DESCRIPTOR_LBOUND(from,i), + GFC_DESCRIPTOR_LBOUND(from,i), 0); } to->offset = from->offset; diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c index 4c89dad..b611d77 100644 --- a/libgfortran/intrinsics/pack_generic.c +++ b/libgfortran/intrinsics/pack_generic.c @@ -121,11 +121,11 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride * size; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = size; @@ -141,7 +141,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); } else { @@ -204,9 +204,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -223,7 +221,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -231,7 +229,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array, } } - rstride0 = ret->dim[0].stride * size; + rstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(ret,0); if (rstride0 == 0) rstride0 = size; sstride0 = sstride[0]; @@ -280,11 +278,11 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride * size; + sstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(vector,0); if (sstride0 == 0) sstride0 = size; @@ -511,11 +509,11 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; - sstride[n] = array->dim[n].stride * size; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); ssize *= extent[n]; } if (sstride[0] == 0) @@ -536,7 +534,7 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array, { /* The return array will have as many elements as there are in vector. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total <= 0) { total = 0; @@ -559,9 +557,8 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array, } /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0],0,total-1,1); + ret->offset = 0; if (total == 0) @@ -573,7 +570,7 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array, ret->data = internal_malloc_size (size * total); } - rstride0 = ret->dim[0].stride * size; + rstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(ret,0); if (rstride0 == 0) rstride0 = size; rptr = ret->data; @@ -623,11 +620,11 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride * size; + sstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(vector,0); if (sstride0 == 0) sstride0 = size; diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c index 0d1f25f..803049b 100644 --- a/libgfortran/intrinsics/random.c +++ b/libgfortran/intrinsics/random.c @@ -374,8 +374,8 @@ arandom_r4 (gfc_array_r4 *x) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = x->dim[n].stride; - extent[n] = x->dim[n].ubound + 1 - x->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(x,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(x,n); if (extent[n] <= 0) return; } @@ -441,8 +441,8 @@ arandom_r8 (gfc_array_r8 *x) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = x->dim[n].stride; - extent[n] = x->dim[n].ubound + 1 - x->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(x,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(x,n); if (extent[n] <= 0) return; } @@ -511,8 +511,8 @@ arandom_r10 (gfc_array_r10 *x) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = x->dim[n].stride; - extent[n] = x->dim[n].ubound + 1 - x->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(x,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(x,n); if (extent[n] <= 0) return; } @@ -583,8 +583,8 @@ arandom_r16 (gfc_array_r16 *x) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = x->dim[n].stride; - extent[n] = x->dim[n].ubound + 1 - x->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(x,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(x,n); if (extent[n] <= 0) return; } @@ -690,13 +690,13 @@ random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get) runtime_error ("Array rank of PUT is not 1."); /* If the array is too small, abort. */ - if (((put->dim[0].ubound + 1 - put->dim[0].lbound)) < kiss_size) + if (GFC_DESCRIPTOR_EXTENT(put,0) < kiss_size) runtime_error ("Array size of PUT is too small."); /* We copy the seed given by the user. */ for (i = 0; i < kiss_size; i++) memcpy (seed + i * sizeof(GFC_UINTEGER_4), - &(put->data[(kiss_size - 1 - i) * put->dim[0].stride]), + &(put->data[(kiss_size - 1 - i) * GFC_DESCRIPTOR_STRIDE(put,0)]), sizeof(GFC_UINTEGER_4)); /* We put it after scrambling the bytes, to paper around users who @@ -712,7 +712,7 @@ random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get) runtime_error ("Array rank of GET is not 1."); /* If the array is too small, abort. */ - if (((get->dim[0].ubound + 1 - get->dim[0].lbound)) < kiss_size) + if (GFC_DESCRIPTOR_EXTENT(get,0) < kiss_size) runtime_error ("Array size of GET is too small."); /* Unscramble the seed. */ @@ -720,7 +720,7 @@ random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get) /* Then copy it back to the user variable. */ for (i = 0; i < kiss_size; i++) - memcpy (&(get->data[(kiss_size - 1 - i) * get->dim[0].stride]), + memcpy (&(get->data[(kiss_size - 1 - i) * GFC_DESCRIPTOR_STRIDE(get,0)]), seed + i * sizeof(GFC_UINTEGER_4), sizeof(GFC_UINTEGER_4)); } @@ -757,12 +757,12 @@ random_seed_i8 (GFC_INTEGER_8 *size, gfc_array_i8 *put, gfc_array_i8 *get) runtime_error ("Array rank of PUT is not 1."); /* If the array is too small, abort. */ - if (((put->dim[0].ubound + 1 - put->dim[0].lbound)) < kiss_size / 2) + if (GFC_DESCRIPTOR_EXTENT(put,0) < kiss_size / 2) runtime_error ("Array size of PUT is too small."); /* This code now should do correct strides. */ for (i = 0; i < kiss_size / 2; i++) - memcpy (&kiss_seed[2*i], &(put->data[i * put->dim[0].stride]), + memcpy (&kiss_seed[2*i], &(put->data[i * GFC_DESCRIPTOR_STRIDE(put,0)]), sizeof (GFC_UINTEGER_8)); } @@ -774,12 +774,12 @@ random_seed_i8 (GFC_INTEGER_8 *size, gfc_array_i8 *put, gfc_array_i8 *get) runtime_error ("Array rank of GET is not 1."); /* If the array is too small, abort. */ - if (((get->dim[0].ubound + 1 - get->dim[0].lbound)) < kiss_size / 2) + if (GFC_DESCRIPTOR_EXTENT(get,0) < kiss_size / 2) runtime_error ("Array size of GET is too small."); /* This code now should do correct strides. */ for (i = 0; i < kiss_size / 2; i++) - memcpy (&(get->data[i * get->dim[0].stride]), &kiss_seed[2*i], + memcpy (&(get->data[i * GFC_DESCRIPTOR_STRIDE(get,0)]), &kiss_seed[2*i], sizeof (GFC_UINTEGER_8)); } diff --git a/libgfortran/intrinsics/reshape_generic.c b/libgfortran/intrinsics/reshape_generic.c index 0f30227..bb1552aa 100644 --- a/libgfortran/intrinsics/reshape_generic.c +++ b/libgfortran/intrinsics/reshape_generic.c @@ -67,7 +67,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -75,7 +75,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -85,14 +85,13 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, if (ret->data == NULL) { - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n],0,rex - 1,rs); + rs *= rex; } ret->offset = 0; @@ -111,8 +110,8 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -142,7 +141,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -155,7 +154,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -174,7 +173,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -193,13 +192,13 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] != shape_data[dim]) runtime_error ("shape and target do not conform"); @@ -218,8 +217,8 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/intrinsics/size.c b/libgfortran/intrinsics/size.c index 9aa4cd9..6127c4e 100644 --- a/libgfortran/intrinsics/size.c +++ b/libgfortran/intrinsics/size.c @@ -35,7 +35,7 @@ size0 (const array_t * array) size = 1; for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++) { - len = array->dim[n].ubound + 1 - array->dim[n].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,n); if (len < 0) len = 0; size *= len; @@ -54,7 +54,7 @@ size1 (const array_t * array, index_type dim) dim--; - size = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + size = GFC_DESCRIPTOR_EXTENT(array,dim); if (size < 0) size = 0; return size; diff --git a/libgfortran/intrinsics/spread_generic.c b/libgfortran/intrinsics/spread_generic.c index 9fb4b11..9e20b85 100644 --- a/libgfortran/intrinsics/spread_generic.c +++ b/libgfortran/intrinsics/spread_generic.c @@ -30,8 +30,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see static void spread_internal (gfc_array_char *ret, const gfc_array_char *source, - const index_type *along, const index_type *pncopies, - index_type size) + const index_type *along, const index_type *pncopies) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -52,6 +51,9 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source, index_type n; index_type dim; index_type ncopies; + index_type size; + + size = GFC_DESCRIPTOR_SIZE(source); srank = GFC_DESCRIPTOR_RANK(source); @@ -68,31 +70,34 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source, { /* The front end has signalled that we need to populate the return array descriptor. */ + + size_t ub, stride; + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; dim = 0; rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == *along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs * size; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride * size; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(source,dim); rstride[dim] = rs * size; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim]-1; rs *= extent[dim]; dim++; } + + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -119,10 +124,10 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == *along - 1) { - rdelta = ret->dim[n].stride * size; + rdelta = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -133,8 +138,7 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -144,8 +148,8 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride * size; - rstride[dim] = ret->dim[n].stride * size; + sstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n); dim++; } } @@ -156,17 +160,16 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source, { if (n == *along - 1) { - rdelta = ret->dim[n].stride * size; + rdelta = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride * size; - rstride[dim] = ret->dim[n].stride * size; + sstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n); dim++; } } @@ -228,12 +231,14 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source, static void spread_internal_scalar (gfc_array_char *ret, const char *source, - const index_type *along, const index_type *pncopies, - index_type size) + const index_type *along, const index_type *pncopies) { int n; int ncopies = *pncopies; char * dest; + size_t size; + + size = GFC_DESCRIPTOR_SIZE(ret); if (GFC_DESCRIPTOR_RANK (ret) != 1) runtime_error ("incorrect destination rank in spread()"); @@ -245,20 +250,18 @@ spread_internal_scalar (gfc_array_char *ret, const char *source, { ret->data = internal_malloc_size (ncopies * size); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } for (n = 0; n < ncopies; n++) { - dest = (char*)(ret->data + n*size*ret->dim[0].stride); + dest = (char*)(ret->data + n * GFC_DESCRIPTOR_STRIDE_BYTES(ret,0)); memcpy (dest , source, size); } } @@ -400,7 +403,7 @@ spread (gfc_array_char *ret, const gfc_array_char *source, #endif } - spread_internal (ret, source, along, pncopies, GFC_DESCRIPTOR_SIZE (source)); + spread_internal (ret, source, along, pncopies); } @@ -413,9 +416,10 @@ void spread_char (gfc_array_char *ret, GFC_INTEGER_4 ret_length __attribute__((unused)), const gfc_array_char *source, const index_type *along, - const index_type *pncopies, GFC_INTEGER_4 source_length) + const index_type *pncopies, + GFC_INTEGER_4 source_length __attribute__((unused))) { - spread_internal (ret, source, along, pncopies, source_length); + spread_internal (ret, source, along, pncopies); } @@ -428,10 +432,10 @@ void spread_char4 (gfc_array_char *ret, GFC_INTEGER_4 ret_length __attribute__((unused)), const gfc_array_char *source, const index_type *along, - const index_type *pncopies, GFC_INTEGER_4 source_length) + const index_type *pncopies, + GFC_INTEGER_4 source_length __attribute__((unused))) { - spread_internal (ret, source, along, pncopies, - source_length * sizeof (gfc_char4_t)); + spread_internal (ret, source, along, pncopies); } @@ -577,7 +581,7 @@ spread_scalar (gfc_array_char *ret, const char *source, #endif } - spread_internal_scalar (ret, source, along, pncopies, GFC_DESCRIPTOR_SIZE (ret)); + spread_internal_scalar (ret, source, along, pncopies); } @@ -590,11 +594,12 @@ void spread_char_scalar (gfc_array_char *ret, GFC_INTEGER_4 ret_length __attribute__((unused)), const char *source, const index_type *along, - const index_type *pncopies, GFC_INTEGER_4 source_length) + const index_type *pncopies, + GFC_INTEGER_4 source_length __attribute__((unused))) { if (!ret->dtype) runtime_error ("return array missing descriptor in spread()"); - spread_internal_scalar (ret, source, along, pncopies, source_length); + spread_internal_scalar (ret, source, along, pncopies); } @@ -607,11 +612,12 @@ void spread_char4_scalar (gfc_array_char *ret, GFC_INTEGER_4 ret_length __attribute__((unused)), const char *source, const index_type *along, - const index_type *pncopies, GFC_INTEGER_4 source_length) + const index_type *pncopies, + GFC_INTEGER_4 source_length __attribute__((unused))) { if (!ret->dtype) runtime_error ("return array missing descriptor in spread()"); - spread_internal_scalar (ret, source, along, pncopies, - source_length * sizeof (gfc_char4_t)); + spread_internal_scalar (ret, source, along, pncopies); + } diff --git a/libgfortran/intrinsics/stat.c b/libgfortran/intrinsics/stat.c index 5d0f3b63..22d4f79 100644 --- a/libgfortran/intrinsics/stat.c +++ b/libgfortran/intrinsics/stat.c @@ -66,7 +66,7 @@ stat_i4_sub_0 (char *name, gfc_array_i4 *sarray, GFC_INTEGER_4 *status, runtime_error ("Array rank of SARRAY is not 1."); /* If the array is too small, abort. */ - if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13) + if (GFC_DESCRIPTOR_EXTENT(sarray,0) < 13) runtime_error ("Array size of SARRAY is too small."); /* Trim trailing spaces from name. */ @@ -88,55 +88,57 @@ stat_i4_sub_0 (char *name, gfc_array_i4 *sarray, GFC_INTEGER_4 *status, if (val == 0) { + index_type stride = GFC_DESCRIPTOR_STRIDE(sarray,0); + /* Device ID */ - sarray->data[0 * sarray->dim[0].stride] = sb.st_dev; + sarray->data[0 * stride] = sb.st_dev; /* Inode number */ - sarray->data[1 * sarray->dim[0].stride] = sb.st_ino; + sarray->data[1 * stride] = sb.st_ino; /* File mode */ - sarray->data[2 * sarray->dim[0].stride] = sb.st_mode; + sarray->data[2 * stride] = sb.st_mode; /* Number of (hard) links */ - sarray->data[3 * sarray->dim[0].stride] = sb.st_nlink; + sarray->data[3 * stride] = sb.st_nlink; /* Owner's uid */ - sarray->data[4 * sarray->dim[0].stride] = sb.st_uid; + sarray->data[4 * stride] = sb.st_uid; /* Owner's gid */ - sarray->data[5 * sarray->dim[0].stride] = sb.st_gid; + sarray->data[5 * stride] = sb.st_gid; /* ID of device containing directory entry for file (0 if not available) */ #if HAVE_STRUCT_STAT_ST_RDEV - sarray->data[6 * sarray->dim[0].stride] = sb.st_rdev; + sarray->data[6 * stride] = sb.st_rdev; #else - sarray->data[6 * sarray->dim[0].stride] = 0; + sarray->data[6 * stride] = 0; #endif /* File size (bytes) */ - sarray->data[7 * sarray->dim[0].stride] = sb.st_size; + sarray->data[7 * stride] = sb.st_size; /* Last access time */ - sarray->data[8 * sarray->dim[0].stride] = sb.st_atime; + sarray->data[8 * stride] = sb.st_atime; /* Last modification time */ - sarray->data[9 * sarray->dim[0].stride] = sb.st_mtime; + sarray->data[9 * stride] = sb.st_mtime; /* Last file status change time */ - sarray->data[10 * sarray->dim[0].stride] = sb.st_ctime; + sarray->data[10 * stride] = sb.st_ctime; /* Preferred I/O block size (-1 if not available) */ #if HAVE_STRUCT_STAT_ST_BLKSIZE - sarray->data[11 * sarray->dim[0].stride] = sb.st_blksize; + sarray->data[11 * stride] = sb.st_blksize; #else - sarray->data[11 * sarray->dim[0].stride] = -1; + sarray->data[11 * stride] = -1; #endif /* Number of blocks allocated (-1 if not available) */ #if HAVE_STRUCT_STAT_ST_BLOCKS - sarray->data[12 * sarray->dim[0].stride] = sb.st_blocks; + sarray->data[12 * stride] = sb.st_blocks; #else - sarray->data[12 * sarray->dim[0].stride] = -1; + sarray->data[12 * stride] = -1; #endif } @@ -185,7 +187,7 @@ stat_i8_sub_0 (char *name, gfc_array_i8 *sarray, GFC_INTEGER_8 *status, runtime_error ("Array rank of SARRAY is not 1."); /* If the array is too small, abort. */ - if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13) + if (GFC_DESCRIPTOR_EXTENT(sarray,0) < 13) runtime_error ("Array size of SARRAY is too small."); /* Trim trailing spaces from name. */ @@ -207,55 +209,57 @@ stat_i8_sub_0 (char *name, gfc_array_i8 *sarray, GFC_INTEGER_8 *status, if (val == 0) { + index_type stride = GFC_DESCRIPTOR_STRIDE(sarray,0); + /* Device ID */ sarray->data[0] = sb.st_dev; /* Inode number */ - sarray->data[sarray->dim[0].stride] = sb.st_ino; + sarray->data[stride] = sb.st_ino; /* File mode */ - sarray->data[2 * sarray->dim[0].stride] = sb.st_mode; + sarray->data[2 * stride] = sb.st_mode; /* Number of (hard) links */ - sarray->data[3 * sarray->dim[0].stride] = sb.st_nlink; + sarray->data[3 * stride] = sb.st_nlink; /* Owner's uid */ - sarray->data[4 * sarray->dim[0].stride] = sb.st_uid; + sarray->data[4 * stride] = sb.st_uid; /* Owner's gid */ - sarray->data[5 * sarray->dim[0].stride] = sb.st_gid; + sarray->data[5 * stride] = sb.st_gid; /* ID of device containing directory entry for file (0 if not available) */ #if HAVE_STRUCT_STAT_ST_RDEV - sarray->data[6 * sarray->dim[0].stride] = sb.st_rdev; + sarray->data[6 * stride] = sb.st_rdev; #else - sarray->data[6 * sarray->dim[0].stride] = 0; + sarray->data[6 * stride] = 0; #endif /* File size (bytes) */ - sarray->data[7 * sarray->dim[0].stride] = sb.st_size; + sarray->data[7 * stride] = sb.st_size; /* Last access time */ - sarray->data[8 * sarray->dim[0].stride] = sb.st_atime; + sarray->data[8 * stride] = sb.st_atime; /* Last modification time */ - sarray->data[9 * sarray->dim[0].stride] = sb.st_mtime; + sarray->data[9 * stride] = sb.st_mtime; /* Last file status change time */ - sarray->data[10 * sarray->dim[0].stride] = sb.st_ctime; + sarray->data[10 * stride] = sb.st_ctime; /* Preferred I/O block size (-1 if not available) */ #if HAVE_STRUCT_STAT_ST_BLKSIZE - sarray->data[11 * sarray->dim[0].stride] = sb.st_blksize; + sarray->data[11 * stride] = sb.st_blksize; #else - sarray->data[11 * sarray->dim[0].stride] = -1; + sarray->data[11 * stride] = -1; #endif /* Number of blocks allocated (-1 if not available) */ #if HAVE_STRUCT_STAT_ST_BLOCKS - sarray->data[12 * sarray->dim[0].stride] = sb.st_blocks; + sarray->data[12 * stride] = sb.st_blocks; #else - sarray->data[12 * sarray->dim[0].stride] = -1; + sarray->data[12 * stride] = -1; #endif } @@ -376,7 +380,7 @@ fstat_i4_sub (GFC_INTEGER_4 *unit, gfc_array_i4 *sarray, GFC_INTEGER_4 *status) runtime_error ("Array rank of SARRAY is not 1."); /* If the array is too small, abort. */ - if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13) + if (GFC_DESCRIPTOR_EXTENT(sarray,0) < 13) runtime_error ("Array size of SARRAY is too small."); /* Convert Fortran unit number to C file descriptor. */ @@ -386,55 +390,57 @@ fstat_i4_sub (GFC_INTEGER_4 *unit, gfc_array_i4 *sarray, GFC_INTEGER_4 *status) if (val == 0) { + index_type stride = GFC_DESCRIPTOR_STRIDE(sarray,0); + /* Device ID */ - sarray->data[0 * sarray->dim[0].stride] = sb.st_dev; + sarray->data[0 * stride] = sb.st_dev; /* Inode number */ - sarray->data[1 * sarray->dim[0].stride] = sb.st_ino; + sarray->data[1 * stride] = sb.st_ino; /* File mode */ - sarray->data[2 * sarray->dim[0].stride] = sb.st_mode; + sarray->data[2 * stride] = sb.st_mode; /* Number of (hard) links */ - sarray->data[3 * sarray->dim[0].stride] = sb.st_nlink; + sarray->data[3 * stride] = sb.st_nlink; /* Owner's uid */ - sarray->data[4 * sarray->dim[0].stride] = sb.st_uid; + sarray->data[4 * stride] = sb.st_uid; /* Owner's gid */ - sarray->data[5 * sarray->dim[0].stride] = sb.st_gid; + sarray->data[5 * stride] = sb.st_gid; /* ID of device containing directory entry for file (0 if not available) */ #if HAVE_STRUCT_STAT_ST_RDEV - sarray->data[6 * sarray->dim[0].stride] = sb.st_rdev; + sarray->data[6 * stride] = sb.st_rdev; #else - sarray->data[6 * sarray->dim[0].stride] = 0; + sarray->data[6 * stride] = 0; #endif /* File size (bytes) */ - sarray->data[7 * sarray->dim[0].stride] = sb.st_size; + sarray->data[7 * stride] = sb.st_size; /* Last access time */ - sarray->data[8 * sarray->dim[0].stride] = sb.st_atime; + sarray->data[8 * stride] = sb.st_atime; /* Last modification time */ - sarray->data[9 * sarray->dim[0].stride] = sb.st_mtime; + sarray->data[9 * stride] = sb.st_mtime; /* Last file status change time */ - sarray->data[10 * sarray->dim[0].stride] = sb.st_ctime; + sarray->data[10 * stride] = sb.st_ctime; /* Preferred I/O block size (-1 if not available) */ #if HAVE_STRUCT_STAT_ST_BLKSIZE - sarray->data[11 * sarray->dim[0].stride] = sb.st_blksize; + sarray->data[11 * stride] = sb.st_blksize; #else - sarray->data[11 * sarray->dim[0].stride] = -1; + sarray->data[11 * stride] = -1; #endif /* Number of blocks allocated (-1 if not available) */ #if HAVE_STRUCT_STAT_ST_BLOCKS - sarray->data[12 * sarray->dim[0].stride] = sb.st_blocks; + sarray->data[12 * stride] = sb.st_blocks; #else - sarray->data[12 * sarray->dim[0].stride] = -1; + sarray->data[12 * stride] = -1; #endif } @@ -457,7 +463,7 @@ fstat_i8_sub (GFC_INTEGER_8 *unit, gfc_array_i8 *sarray, GFC_INTEGER_8 *status) runtime_error ("Array rank of SARRAY is not 1."); /* If the array is too small, abort. */ - if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13) + if (GFC_DESCRIPTOR_EXTENT(sarray,0) < 13) runtime_error ("Array size of SARRAY is too small."); /* Convert Fortran unit number to C file descriptor. */ @@ -467,55 +473,57 @@ fstat_i8_sub (GFC_INTEGER_8 *unit, gfc_array_i8 *sarray, GFC_INTEGER_8 *status) if (val == 0) { + index_type stride = GFC_DESCRIPTOR_STRIDE(sarray,0); + /* Device ID */ sarray->data[0] = sb.st_dev; /* Inode number */ - sarray->data[sarray->dim[0].stride] = sb.st_ino; + sarray->data[stride] = sb.st_ino; /* File mode */ - sarray->data[2 * sarray->dim[0].stride] = sb.st_mode; + sarray->data[2 * stride] = sb.st_mode; /* Number of (hard) links */ - sarray->data[3 * sarray->dim[0].stride] = sb.st_nlink; + sarray->data[3 * stride] = sb.st_nlink; /* Owner's uid */ - sarray->data[4 * sarray->dim[0].stride] = sb.st_uid; + sarray->data[4 * stride] = sb.st_uid; /* Owner's gid */ - sarray->data[5 * sarray->dim[0].stride] = sb.st_gid; + sarray->data[5 * stride] = sb.st_gid; /* ID of device containing directory entry for file (0 if not available) */ #if HAVE_STRUCT_STAT_ST_RDEV - sarray->data[6 * sarray->dim[0].stride] = sb.st_rdev; + sarray->data[6 * stride] = sb.st_rdev; #else - sarray->data[6 * sarray->dim[0].stride] = 0; + sarray->data[6 * stride] = 0; #endif /* File size (bytes) */ - sarray->data[7 * sarray->dim[0].stride] = sb.st_size; + sarray->data[7 * stride] = sb.st_size; /* Last access time */ - sarray->data[8 * sarray->dim[0].stride] = sb.st_atime; + sarray->data[8 * stride] = sb.st_atime; /* Last modification time */ - sarray->data[9 * sarray->dim[0].stride] = sb.st_mtime; + sarray->data[9 * stride] = sb.st_mtime; /* Last file status change time */ - sarray->data[10 * sarray->dim[0].stride] = sb.st_ctime; + sarray->data[10 * stride] = sb.st_ctime; /* Preferred I/O block size (-1 if not available) */ #if HAVE_STRUCT_STAT_ST_BLKSIZE - sarray->data[11 * sarray->dim[0].stride] = sb.st_blksize; + sarray->data[11 * stride] = sb.st_blksize; #else - sarray->data[11 * sarray->dim[0].stride] = -1; + sarray->data[11 * stride] = -1; #endif /* Number of blocks allocated (-1 if not available) */ #if HAVE_STRUCT_STAT_ST_BLOCKS - sarray->data[12 * sarray->dim[0].stride] = sb.st_blocks; + sarray->data[12 * stride] = sb.st_blocks; #else - sarray->data[12 * sarray->dim[0].stride] = -1; + sarray->data[12 * stride] = -1; #endif } diff --git a/libgfortran/intrinsics/transpose_generic.c b/libgfortran/intrinsics/transpose_generic.c index 2585619..b0c2fff 100644 --- a/libgfortran/intrinsics/transpose_generic.c +++ b/libgfortran/intrinsics/transpose_generic.c @@ -32,8 +32,7 @@ extern void transpose (gfc_array_char *, gfc_array_char *); export_proto(transpose); static void -transpose_internal (gfc_array_char *ret, gfc_array_char *source, - index_type size) +transpose_internal (gfc_array_char *ret, gfc_array_char *source) { /* r.* indicates the return array. */ index_type rxstride, rystride; @@ -44,21 +43,22 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source, index_type xcount, ycount; index_type x, y; + index_type size; assert (GFC_DESCRIPTOR_RANK (source) == 2 && GFC_DESCRIPTOR_RANK (ret) == 2); + size = GFC_DESCRIPTOR_SIZE(ret); + if (ret->data == NULL) { assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (size * size0 ((array_t*)ret)); ret->offset = 0; @@ -67,8 +67,8 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -76,8 +76,8 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -87,13 +87,13 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source, } - sxstride = source->dim[0].stride * size; - systride = source->dim[1].stride * size; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE_BYTES(source,0); + systride = GFC_DESCRIPTOR_STRIDE_BYTES(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride * size; - rystride = ret->dim[1].stride * size; + rxstride = GFC_DESCRIPTOR_STRIDE_BYTES(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE_BYTES(ret,1); rptr = ret->data; sptr = source->data; @@ -119,7 +119,7 @@ export_proto(transpose); void transpose (gfc_array_char *ret, gfc_array_char *source) { - transpose_internal (ret, source, GFC_DESCRIPTOR_SIZE (source)); + transpose_internal (ret, source); } @@ -130,9 +130,10 @@ export_proto(transpose_char); void transpose_char (gfc_array_char *ret, GFC_INTEGER_4 ret_length __attribute__((unused)), - gfc_array_char *source, GFC_INTEGER_4 source_length) + gfc_array_char *source, + GFC_INTEGER_4 source_length __attribute__((unused))) { - transpose_internal (ret, source, source_length); + transpose_internal (ret, source); } @@ -143,7 +144,8 @@ export_proto(transpose_char4); void transpose_char4 (gfc_array_char *ret, GFC_INTEGER_4 ret_length __attribute__((unused)), - gfc_array_char *source, GFC_INTEGER_4 source_length) + gfc_array_char *source, + GFC_INTEGER_4 source_length __attribute__((unused))) { - transpose_internal (ret, source, source_length * sizeof (gfc_char4_t)); + transpose_internal (ret, source); } diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c index a27e37c..47d4a6d 100644 --- a/libgfortran/intrinsics/unpack_generic.c +++ b/libgfortran/intrinsics/unpack_generic.c @@ -89,14 +89,13 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride * size; - fstride[n] = field->dim[n].stride * fsize; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret, n); + fstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(field, n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n); rs *= extent[n]; } ret->offset = 0; @@ -108,11 +107,11 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride * size; - fstride[n] = field->dim[n].stride * fsize; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret, n); + fstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(field, n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n); } if (rstride[0] == 0) rstride[0] = size; @@ -126,7 +125,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride * size; + vstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(vector,0); if (vstride0 == 0) vstride0 = size; rstride0 = rstride[0]; diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index f6d5687..c39a51d 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2093,10 +2093,10 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, } /* Check the values of the triplet indices. */ - if ((ls[dim].start > (ssize_t)ad[dim].ubound) - || (ls[dim].start < (ssize_t)ad[dim].lbound) - || (ls[dim].end > (ssize_t)ad[dim].ubound) - || (ls[dim].end < (ssize_t)ad[dim].lbound)) + if ((ls[dim].start > (ssize_t) GFC_DIMENSION_UBOUND(ad[dim])) + || (ls[dim].start < (ssize_t) GFC_DIMENSION_LBOUND(ad[dim])) + || (ls[dim].end > (ssize_t) GFC_DIMENSION_UBOUND(ad[dim])) + || (ls[dim].end < (ssize_t) GFC_DIMENSION_LBOUND(ad[dim]))) { if (is_char) sprintf (parse_err_msg, "Substring out of range"); @@ -2160,8 +2160,8 @@ nml_touch_nodes (namelist_info * nl) for (dim=0; dim < nl->var_rank; dim++) { nl->ls[dim].step = 1; - nl->ls[dim].end = nl->dim[dim].ubound; - nl->ls[dim].start = nl->dim[dim].lbound; + nl->ls[dim].end = GFC_DESCRIPTOR_UBOUND(nl,dim); + nl->ls[dim].start = GFC_DESCRIPTOR_LBOUND(nl,dim); nl->ls[dim].idx = nl->ls[dim].start; } } @@ -2356,8 +2356,9 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset, pdata = (void*)(nl->mem_pos + offset); for (dim = 0; dim < nl->var_rank; dim++) - pdata = (void*)(pdata + (nl->ls[dim].idx - nl->dim[dim].lbound) * - nl->dim[dim].stride * nl->size); + pdata = (void*)(pdata + (nl->ls[dim].idx + - GFC_DESCRIPTOR_LBOUND(nl,dim)) + * GFC_DESCRIPTOR_STRIDE(nl,dim) * nl->size); /* Reset the error flag and try to read next value, if dtp->u.p.repeat_count=0 */ @@ -2679,8 +2680,8 @@ get_name: for (dim=0; dim < nl->var_rank; dim++) { nl->ls[dim].step = 1; - nl->ls[dim].end = nl->dim[dim].ubound; - nl->ls[dim].start = nl->dim[dim].lbound; + nl->ls[dim].end = GFC_DESCRIPTOR_UBOUND(nl,dim); + nl->ls[dim].start = GFC_DESCRIPTOR_LBOUND(nl,dim); nl->ls[dim].idx = nl->ls[dim].start; } diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 08ba7f5..585ae43 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1778,10 +1778,8 @@ transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind, for (n = 0; n < rank; n++) { count[n] = 0; - stride[n] = iotype == BT_CHARACTER ? - desc->dim[n].stride * GFC_SIZE_OF_CHAR_KIND(kind) : - desc->dim[n].stride; - extent[n] = desc->dim[n].ubound + 1 - desc->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(desc,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(desc,n); /* If the extent of even one dimension is zero, then the entire array section contains zero elements, so we return after writing @@ -1797,9 +1795,9 @@ transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind, stride0 = stride[0]; - /* If the innermost dimension has stride 1, we can do the transfer + /* If the innermost dimension has a stride of 1, we can do the transfer in contiguous chunks. */ - if (stride0 == 1) + if (stride0 == size) tsize = extent[0]; else tsize = 1; @@ -1809,13 +1807,13 @@ transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind, while (data) { dtp->u.p.transfer (dtp, iotype, data, kind, size, tsize); - data += stride0 * size * tsize; + data += stride0 * tsize; count[0] += tsize; n = 0; while (count[n] == extent[n]) { count[n] = 0; - data -= stride[n] * extent[n] * size; + data -= stride[n] * extent[n]; n++; if (n == rank) { @@ -1825,7 +1823,7 @@ transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind, else { count[n]++; - data += stride[n] * size; + data += stride[n]; } } } @@ -2490,23 +2488,24 @@ init_loop_spec (gfc_array_char *desc, array_loop_spec *ls, for (i=0; i<rank; i++) { - ls[i].idx = desc->dim[i].lbound; - ls[i].start = desc->dim[i].lbound; - ls[i].end = desc->dim[i].ubound; - ls[i].step = desc->dim[i].stride; - empty = empty || (desc->dim[i].ubound < desc->dim[i].lbound); + ls[i].idx = GFC_DESCRIPTOR_LBOUND(desc,i); + ls[i].start = GFC_DESCRIPTOR_LBOUND(desc,i); + ls[i].end = GFC_DESCRIPTOR_UBOUND(desc,i); + ls[i].step = GFC_DESCRIPTOR_STRIDE(desc,i); + empty = empty || (GFC_DESCRIPTOR_UBOUND(desc,i) + < GFC_DESCRIPTOR_LBOUND(desc,i)); - if (desc->dim[i].stride > 0) + if (GFC_DESCRIPTOR_STRIDE(desc,i) > 0) { - index += (desc->dim[i].ubound - desc->dim[i].lbound) - * desc->dim[i].stride; + index += (GFC_DESCRIPTOR_EXTENT(desc,i) - 1) + * GFC_DESCRIPTOR_STRIDE(desc,i); } else { - index -= (desc->dim[i].ubound - desc->dim[i].lbound) - * desc->dim[i].stride; - *start_record -= (desc->dim[i].ubound - desc->dim[i].lbound) - * desc->dim[i].stride; + index -= (GFC_DESCRIPTOR_EXTENT(desc,i) - 1) + * GFC_DESCRIPTOR_STRIDE(desc,i); + *start_record -= (GFC_DESCRIPTOR_EXTENT(desc,i) - 1) + * GFC_DESCRIPTOR_STRIDE(desc,i); } } @@ -3400,9 +3399,7 @@ st_set_nml_var_dim (st_parameter_dt *dtp, GFC_INTEGER_4 n_dim, for (nml = dtp->u.p.ionml; nml->next; nml = nml->next); - nml->dim[n].stride = stride; - nml->dim[n].lbound = lbound; - nml->dim[n].ubound = ubound; + GFC_DIMENSION_SET(nml->dim[n],lbound,ubound,stride); } /* Reverse memcpy - used for byte swapping. */ diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index b6d6e68..4956da8 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1316,8 +1316,8 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset, nelem = 1; for (dim_i = 0; dim_i < (size_t) obj->var_rank; dim_i++) { - obj->ls[dim_i].idx = obj->dim[dim_i].lbound; - nelem = nelem * (obj->dim[dim_i].ubound + 1 - obj->dim[dim_i].lbound); + obj->ls[dim_i].idx = GFC_DESCRIPTOR_LBOUND(obj, dim_i); + nelem = nelem * GFC_DESCRIPTOR_EXTENT (obj, dim_i); } /* Main loop to output the data held in the object. */ @@ -1484,9 +1484,9 @@ obj_loop: { obj->ls[dim_i].idx += nml_carry ; nml_carry = 0; - if (obj->ls[dim_i].idx > (index_type) obj->dim[dim_i].ubound) + if (obj->ls[dim_i].idx > (ssize_t) GFC_DESCRIPTOR_UBOUND(obj,dim_i)) { - obj->ls[dim_i].idx = obj->dim[dim_i].lbound; + obj->ls[dim_i].idx = GFC_DESCRIPTOR_LBOUND(obj,dim_i); nml_carry = 1; } } diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index fcf736a..517ee76 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -297,10 +297,11 @@ internal_proto(big_endian); typedef struct descriptor_dimension { - index_type stride; - index_type lbound; - index_type ubound; + index_type _stride; + index_type _lbound; + index_type _ubound; } + descriptor_dimension; #define GFC_ARRAY_DESCRIPTOR(r, type) \ @@ -353,6 +354,30 @@ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_16) gfc_array_l16; #define GFC_DESCRIPTOR_DATA(desc) ((desc)->data) #define GFC_DESCRIPTOR_DTYPE(desc) ((desc)->dtype) +#define GFC_DIMENSION_LBOUND(dim) ((dim)._lbound) +#define GFC_DIMENSION_UBOUND(dim) ((dim)._ubound) +#define GFC_DIMENSION_STRIDE(dim) ((dim)._stride) +#define GFC_DIMENSION_EXTENT(dim) ((dim)._ubound + 1 - (dim)._lbound) +#define GFC_DIMENSION_SET(dim,lb,ub,str) \ + do \ + { \ + (dim)._lbound = lb; \ + (dim)._ubound = ub; \ + (dim)._stride = str; \ + } while (0) + + +#define GFC_DESCRIPTOR_LBOUND(desc,i) ((desc)->dim[i]._lbound) +#define GFC_DESCRIPTOR_UBOUND(desc,i) ((desc)->dim[i]._ubound) +#define GFC_DESCRIPTOR_EXTENT(desc,i) ((desc)->dim[i]._ubound + 1 \ + - (desc)->dim[i]._lbound) +#define GFC_DESCRIPTOR_EXTENT_BYTES(desc,i) \ + (GFC_DESCRIPTOR_EXTENT(desc,i) * GFC_DESCRIPTOR_SIZE(desc)) + +#define GFC_DESCRIPTOR_STRIDE(desc,i) ((desc)->dim[i]._stride) +#define GFC_DESCRIPTOR_STRIDE_BYTES(desc,i) \ + (GFC_DESCRIPTOR_STRIDE(desc,i) * GFC_DESCRIPTOR_SIZE(desc)) + /* Macros to get both the size and the type with a single masking operation */ #define GFC_DTYPE_SIZE_MASK \ diff --git a/libgfortran/m4/cshift0.m4 b/libgfortran/m4/cshift0.m4 index da385cb..0c5e015 100644 --- a/libgfortran/m4/cshift0.m4 +++ b/libgfortran/m4/cshift0.m4 @@ -70,20 +70,20 @@ cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, ssize_t shift, { if (dim == which) { - roffset = ret->dim[dim].stride; + roffset = GFC_DESCRIPTOR_STRIDE(ret,dim); if (roffset == 0) roffset = 1; - soffset = array->dim[dim].stride; + soffset = GFC_DESCRIPTOR_STRIDE(array,dim); if (soffset == 0) soffset = 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride; - sstride[n] = array->dim[dim].stride; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim); n++; } } diff --git a/libgfortran/m4/cshift1.m4 b/libgfortran/m4/cshift1.m4 index 3c5ff5e..22b6185 100644 --- a/libgfortran/m4/cshift1.m4 +++ b/libgfortran/m4/cshift1.m4 @@ -36,8 +36,7 @@ static void cshift1 (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const 'atype` * const restrict h, - const 'atype_name` * const restrict pwhich, - index_type size) + const 'atype_name` * const restrict pwhich) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -64,6 +63,7 @@ cshift1 (gfc_array_char * const restrict ret, int which; 'atype_name` sh; index_type arraysize; + index_type size; if (pwhich) which = *pwhich - 1; @@ -73,6 +73,8 @@ cshift1 (gfc_array_char * const restrict ret, if (which < 0 || (which + 1) > GFC_DESCRIPTOR_RANK (array)) runtime_error ("Argument ''`DIM''` is out of range in call to ''`CSHIFT''`"); + size = GFC_DESCRIPTOR_SIZE(array); + arraysize = size0 ((array_t *)array); if (ret->data == NULL) @@ -84,13 +86,17 @@ cshift1 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) * + GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } } @@ -110,22 +116,22 @@ cshift1 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); n++; } } @@ -211,7 +217,7 @@ cshift1_'atype_kind` (gfc_array_char * const restrict ret, const 'atype` * const restrict h, const 'atype_name` * const restrict pwhich) { - cshift1 (ret, array, h, pwhich, GFC_DESCRIPTOR_SIZE (array)); + cshift1 (ret, array, h, pwhich); } @@ -229,9 +235,9 @@ cshift1_'atype_kind`_char (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const 'atype` * const restrict h, const 'atype_name` * const restrict pwhich, - GFC_INTEGER_4 array_length) + GFC_INTEGER_4 array_length __attribute__((unused))) { - cshift1 (ret, array, h, pwhich, array_length); + cshift1 (ret, array, h, pwhich); } @@ -249,9 +255,9 @@ cshift1_'atype_kind`_char4 (gfc_array_char * const restrict ret, const gfc_array_char * const restrict array, const 'atype` * const restrict h, const 'atype_name` * const restrict pwhich, - GFC_INTEGER_4 array_length) + GFC_INTEGER_4 array_length __attribute__((unused))) { - cshift1 (ret, array, h, pwhich, array_length * sizeof (gfc_char4_t)); + cshift1 (ret, array, h, pwhich); } #endif' diff --git a/libgfortran/m4/eoshift1.m4 b/libgfortran/m4/eoshift1.m4 index 1ecf0a9..831277c 100644 --- a/libgfortran/m4/eoshift1.m4 +++ b/libgfortran/m4/eoshift1.m4 @@ -38,7 +38,7 @@ eoshift1 (gfc_array_char * const restrict ret, const 'atype` * const restrict h, const char * const restrict pbound, const 'atype_name` * const restrict pwhich, - index_type size, const char * filler, index_type filler_len) + const char * filler, index_type filler_len) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -62,6 +62,7 @@ eoshift1 (gfc_array_char * const restrict ret, index_type dim; index_type len; index_type n; + index_type size; int which; 'atype_name` sh; 'atype_name` delta; @@ -72,6 +73,8 @@ eoshift1 (gfc_array_char * const restrict ret, soffset = 0; roffset = 0; + size = GFC_DESCRIPTOR_SIZE(array); + if (pwhich) which = *pwhich - 1; else @@ -89,13 +92,18 @@ eoshift1 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) + * GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + } } else @@ -109,22 +117,22 @@ eoshift1 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); n++; } } @@ -242,8 +250,7 @@ eoshift1_'atype_kind` (gfc_array_char * const restrict ret, const char * const restrict pbound, const 'atype_name` * const restrict pwhich) { - eoshift1 (ret, array, h, pbound, pwhich, GFC_DESCRIPTOR_SIZE (array), - "\0", 1); + eoshift1 (ret, array, h, pbound, pwhich, "\0", 1); } @@ -263,10 +270,10 @@ eoshift1_'atype_kind`_char (gfc_array_char * const restrict ret, const 'atype` * const restrict h, const char * const restrict pbound, const 'atype_name` * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { - eoshift1 (ret, array, h, pbound, pwhich, array_length, " ", 1); + eoshift1 (ret, array, h, pbound, pwhich, " ", 1); } @@ -286,11 +293,11 @@ eoshift1_'atype_kind`_char4 (gfc_array_char * const restrict ret, const 'atype` * const restrict h, const char * const restrict pbound, const 'atype_name` * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { static const gfc_char4_t space = (unsigned char) ''` ''`; - eoshift1 (ret, array, h, pbound, pwhich, array_length * sizeof (gfc_char4_t), + eoshift1 (ret, array, h, pbound, pwhich, (const char *) &space, sizeof (gfc_char4_t)); } diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4 index 902c3cd..e6b2959 100644 --- a/libgfortran/m4/eoshift3.m4 +++ b/libgfortran/m4/eoshift3.m4 @@ -38,7 +38,7 @@ eoshift3 (gfc_array_char * const restrict ret, const 'atype` * const restrict h, const gfc_array_char * const restrict bound, const 'atype_name` * const restrict pwhich, - index_type size, const char * filler, index_type filler_len) + const char * filler, index_type filler_len) { /* r.* indicates the return array. */ index_type rstride[GFC_MAX_DIMENSIONS]; @@ -66,6 +66,7 @@ eoshift3 (gfc_array_char * const restrict ret, index_type dim; index_type len; index_type n; + index_type size; int which; 'atype_name` sh; 'atype_name` delta; @@ -76,6 +77,8 @@ eoshift3 (gfc_array_char * const restrict ret, soffset = 0; roffset = 0; + size = GFC_DESCRIPTOR_SIZE(array); + if (pwhich) which = *pwhich - 1; else @@ -90,13 +93,18 @@ eoshift3 (gfc_array_char * const restrict ret, ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { - ret->dim[i].lbound = 0; - ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound; + index_type ub, str; + + ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1; if (i == 0) - ret->dim[i].stride = 1; + str = 1; else - ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride; + str = GFC_DESCRIPTOR_EXTENT(ret,i-1) + * GFC_DESCRIPTOR_STRIDE(ret,i-1); + + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + } } else @@ -113,24 +121,24 @@ eoshift3 (gfc_array_char * const restrict ret, { if (dim == which) { - roffset = ret->dim[dim].stride * size; + roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); if (roffset == 0) roffset = size; - soffset = array->dim[dim].stride * size; + soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); if (soffset == 0) soffset = size; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); } else { count[n] = 0; - extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; - rstride[n] = ret->dim[dim].stride * size; - sstride[n] = array->dim[dim].stride * size; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim); + rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim); + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); - hstride[n] = h->dim[n].stride; + hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n); if (bound) - bstride[n] = bound->dim[n].stride * size; + bstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(bound,n); else bstride[n] = 0; n++; @@ -261,8 +269,7 @@ eoshift3_'atype_kind` (gfc_array_char * const restrict ret, const gfc_array_char * const restrict bound, const 'atype_name` * const restrict pwhich) { - eoshift3 (ret, array, h, bound, pwhich, GFC_DESCRIPTOR_SIZE (array), - "\0", 1); + eoshift3 (ret, array, h, bound, pwhich, "\0", 1); } @@ -282,10 +289,10 @@ eoshift3_'atype_kind`_char (gfc_array_char * const restrict ret, const 'atype` * const restrict h, const gfc_array_char * const restrict bound, const 'atype_name` * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { - eoshift3 (ret, array, h, bound, pwhich, array_length, " ", 1); + eoshift3 (ret, array, h, bound, pwhich, " ", 1); } @@ -305,11 +312,11 @@ eoshift3_'atype_kind`_char4 (gfc_array_char * const restrict ret, const 'atype` * const restrict h, const gfc_array_char * const restrict bound, const 'atype_name` * const restrict pwhich, - GFC_INTEGER_4 array_length, + GFC_INTEGER_4 array_length __attribute__((unused)), GFC_INTEGER_4 bound_length __attribute__((unused))) { static const gfc_char4_t space = (unsigned char) ''` ''`; - eoshift3 (ret, array, h, bound, pwhich, array_length * sizeof (gfc_char4_t), + eoshift3 (ret, array, h, bound, pwhich, (const char *) &space, sizeof (gfc_char4_t)); } diff --git a/libgfortran/m4/iforeach.m4 b/libgfortran/m4/iforeach.m4 index b620c65..0960d22 100644 --- a/libgfortran/m4/iforeach.m4 +++ b/libgfortran/m4/iforeach.m4 @@ -27,9 +27,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (rtype_name) * rank); @@ -46,7 +44,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, runtime_error ("rank of return array in u_name intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " u_name intrnisic: is %ld, should be %ld", @@ -54,12 +52,12 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -143,9 +141,7 @@ void if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (rtype_name) * rank); @@ -164,7 +160,7 @@ void runtime_error ("rank of return array in u_name intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("Incorrect extent in return value of" " u_name intrnisic: is %ld, should be %ld", @@ -178,8 +174,8 @@ void for (n=0; n<rank; n++) { - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " u_name intrinsic in dimension %ld:" @@ -202,13 +198,13 @@ void else runtime_error ("Funny sized logical array"); - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n < rank; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); count[n] = 0; if (extent[n] <= 0) { @@ -302,9 +298,7 @@ void if (retarray->data == NULL) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = rank-1; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; retarray->data = internal_malloc_size (sizeof (rtype_name) * rank); @@ -321,13 +315,13 @@ void runtime_error ("rank of return array in u_name intrinsic" " should be 1, is %ld", (long int) ret_rank); - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (ret_extent != rank) runtime_error ("dimension of return array incorrect"); } } - dstride = retarray->dim[0].stride; + dstride = GFC_DESCRIPTOR_STRIDE(retarray,0); dest = retarray->data; for (n = 0; n<rank; n++) dest[n * dstride] = $1 ; diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4 index e0c168e..6785eb3 100644 --- a/libgfortran/m4/ifunction.m4 +++ b/libgfortran/m4/ifunction.m4 @@ -45,24 +45,23 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -70,30 +69,31 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (rtype_name) * retarray->dim[rank-1].stride + alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; + } else retarray->data = internal_malloc_size (alloc_size); @@ -112,8 +112,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " u_name intrinsic in dimension %ld:" @@ -126,7 +125,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } @@ -217,7 +216,7 @@ void dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len <= 0) return; @@ -234,14 +233,14 @@ void else runtime_error ("Funny sized logical array"); - delta = array->dim[dim].stride; - mdelta = mask->dim[dim].stride * mask_kind; + delta = GFC_DESCRIPTOR_STRIDE(array,dim); + mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; @@ -249,10 +248,9 @@ void } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; - mstride[n] = mask->dim[n + 1].stride * mask_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1); if (extent[n] < 0) extent[n] = 0; @@ -260,19 +258,20 @@ void if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } - alloc_size = sizeof (rtype_name) * retarray->dim[rank-1].stride + alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; @@ -281,8 +280,7 @@ void if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -300,8 +298,7 @@ void { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " u_name intrinsic in dimension %ld:" @@ -312,8 +309,8 @@ void { index_type mask_extent, array_extent; - array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound; - mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound; + array_extent = GFC_DESCRIPTOR_EXTENT(array,n); + mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n); if (array_extent != mask_extent) runtime_error ("Incorrect extent in MASK argument of" " u_name intrinsic in dimension %ld:" @@ -326,7 +323,7 @@ void for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) return; } @@ -423,8 +420,8 @@ void for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) extent[n] = 0; @@ -432,9 +429,9 @@ void for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1); extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] <= 0) extent[n] = 0; @@ -442,29 +439,29 @@ void if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (rtype_name) * retarray->dim[rank-1].stride + alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -484,8 +481,7 @@ void { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " u_name intrinsic in dimension %ld:" @@ -498,7 +494,7 @@ void for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); } dest = retarray->data; diff --git a/libgfortran/m4/ifunction_logical.m4 b/libgfortran/m4/ifunction_logical.m4 index da6b4ae..d1d2dd0 100644 --- a/libgfortran/m4/ifunction_logical.m4 +++ b/libgfortran/m4/ifunction_logical.m4 @@ -48,25 +48,24 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); - len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + len = GFC_DESCRIPTOR_EXTENT(array,dim); if (len < 0) len = 0; - delta = array->dim[dim].stride * src_kind; + delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim); for (n = 0; n < dim; n++) { - sstride[n] = array->dim[n].stride * src_kind; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] < 0) extent[n] = 0; } for (n = dim; n < rank; n++) { - sstride[n] = array->dim[n + 1].stride * src_kind; - extent[n] = - array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1); + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1); if (extent[n] < 0) extent[n] = 0; @@ -74,29 +73,29 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, if (retarray->data == NULL) { - size_t alloc_size; + size_t alloc_size, str; for (n = 0; n < rank; n++) { - retarray->dim[n].lbound = 0; - retarray->dim[n].ubound = extent[n]-1; if (n == 0) - retarray->dim[n].stride = 1; + str = 1; else - retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1]; + + GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str); + } retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (rtype_name) * retarray->dim[rank-1].stride + alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = -1; + GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1); return; } else @@ -116,8 +115,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, { index_type ret_extent; - ret_extent = retarray->dim[n].ubound + 1 - - retarray->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n); if (extent[n] != ret_extent) runtime_error ("Incorrect extent in return value of" " u_name intrinsic in dimension %d:" @@ -130,7 +128,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, for (n = 0; n < rank; n++) { count[n] = 0; - dstride[n] = retarray->dim[n].stride; + dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n); if (extent[n] <= 0) len = 0; } diff --git a/libgfortran/m4/in_pack.m4 b/libgfortran/m4/in_pack.m4 index b54ea04..a4337aa 100644 --- a/libgfortran/m4/in_pack.m4 +++ b/libgfortran/m4/in_pack.m4 @@ -60,8 +60,8 @@ internal_pack_'rtype_ccode` ('rtype` * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/m4/in_unpack.m4 b/libgfortran/m4/in_unpack.m4 index af71145..661c54e 100644 --- a/libgfortran/m4/in_unpack.m4 +++ b/libgfortran/m4/in_unpack.m4 @@ -55,8 +55,8 @@ internal_unpack_'rtype_ccode` ('rtype` * d, const 'rtype_name` * src) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; diff --git a/libgfortran/m4/matmul.m4 b/libgfortran/m4/matmul.m4 index 8ad1bd1..bb42f2a 100644 --- a/libgfortran/m4/matmul.m4 +++ b/libgfortran/m4/matmul.m4 @@ -106,25 +106,22 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -137,8 +134,8 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -146,8 +143,8 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -155,16 +152,16 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -180,43 +177,43 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl /* One-dimensional result may be addressed in the code below either as a row or a column matrix. We want both cases to work. */ - rxstride = rystride = retarray->dim[0].stride; + rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0); } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } if (GFC_DESCRIPTOR_RANK (a) == 1) { /* Treat it as a a row matrix A[1,count]. */ - axstride = a->dim[0].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); aystride = 1; xcount = 1; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,0); } else { - axstride = a->dim[0].stride; - aystride = a->dim[1].stride; + axstride = GFC_DESCRIPTOR_STRIDE(a,0); + aystride = GFC_DESCRIPTOR_STRIDE(a,1); - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + count = GFC_DESCRIPTOR_EXTENT(a,1); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } - if (count != b->dim[0].ubound + 1 - b->dim[0].lbound) + if (count != GFC_DESCRIPTOR_EXTENT(b,0)) { - if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0) + if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0) runtime_error ("dimension of array B incorrect in MATMUL intrinsic"); } if (GFC_DESCRIPTOR_RANK (b) == 1) { /* Treat it as a column matrix B[count,1] */ - bxstride = b->dim[0].stride; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); /* bystride should never be used for 1-dimensional b. in case it is we want it to cause a segfault, rather than @@ -226,9 +223,9 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl } else { - bxstride = b->dim[0].stride; - bystride = b->dim[1].stride; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bxstride = GFC_DESCRIPTOR_STRIDE(b,0); + bystride = GFC_DESCRIPTOR_STRIDE(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } abase = a->data; diff --git a/libgfortran/m4/matmull.m4 b/libgfortran/m4/matmull.m4 index d971d3d..c5bad25 100644 --- a/libgfortran/m4/matmull.m4 +++ b/libgfortran/m4/matmull.m4 @@ -70,25 +70,22 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, { if (GFC_DESCRIPTOR_RANK (a) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1); } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); } else { - retarray->dim[0].lbound = 0; - retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound; - retarray->dim[0].stride = 1; - - retarray->dim[1].lbound = 0; - retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound; - retarray->dim[1].stride = retarray->dim[0].ubound+1; + GFC_DIMENSION_SET(retarray->dim[0], 0, + GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1); + + GFC_DIMENSION_SET(retarray->dim[1], 0, + GFC_DESCRIPTOR_EXTENT(b,1) - 1, + GFC_DESCRIPTOR_EXTENT(retarray,0)); } retarray->data @@ -101,8 +98,8 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, if (GFC_DESCRIPTOR_RANK (a) == 1) { - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -110,8 +107,8 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, } else if (GFC_DESCRIPTOR_RANK (b) == 1) { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic: is %ld, should be %ld", @@ -119,16 +116,16 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, } else { - arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound; - ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(a,0); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 1:" " is %ld, should be %ld", (long int) ret_extent, (long int) arg_extent); - arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound; - ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound; + arg_extent = GFC_DESCRIPTOR_EXTENT(b,1); + ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1); if (arg_extent != ret_extent) runtime_error ("Incorrect extent in return array in" " MATMUL intrinsic for dimension 2:" @@ -167,46 +164,46 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl ` if (GFC_DESCRIPTOR_RANK (retarray) == 1) { - rxstride = retarray->dim[0].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); rystride = rxstride; } else { - rxstride = retarray->dim[0].stride; - rystride = retarray->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0); + rystride = GFC_DESCRIPTOR_STRIDE(retarray,1); } /* If we have rank 1 parameters, zero the absent stride, and set the size to one. */ if (GFC_DESCRIPTOR_RANK (a) == 1) { - astride = a->dim[0].stride * a_kind; - count = a->dim[0].ubound + 1 - a->dim[0].lbound; + astride = GFC_DESCRIPTOR_STRIDE_BYTES(a,0); + count = GFC_DESCRIPTOR_EXTENT(a,0); xstride = 0; rxstride = 0; xcount = 1; } else { - astride = a->dim[1].stride * a_kind; - count = a->dim[1].ubound + 1 - a->dim[1].lbound; - xstride = a->dim[0].stride * a_kind; - xcount = a->dim[0].ubound + 1 - a->dim[0].lbound; + astride = GFC_DESCRIPTOR_STRIDE_BYTES(a,1); + count = GFC_DESCRIPTOR_EXTENT(a,1); + xstride = GFC_DESCRIPTOR_STRIDE_BYTES(a,0); + xcount = GFC_DESCRIPTOR_EXTENT(a,0); } if (GFC_DESCRIPTOR_RANK (b) == 1) { - bstride = b->dim[0].stride * b_kind; - assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound); + bstride = GFC_DESCRIPTOR_STRIDE_BYTES(b,0); + assert(count == GFC_DESCRIPTOR_EXTENT(b,0)); ystride = 0; rystride = 0; ycount = 1; } else { - bstride = b->dim[0].stride * b_kind; - assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound); - ystride = b->dim[1].stride * b_kind; - ycount = b->dim[1].ubound + 1 - b->dim[1].lbound; + bstride = GFC_DESCRIPTOR_STRIDE_BYTES(b,0); + assert(count == GFC_DESCRIPTOR_EXTENT(b,0)); + ystride = GFC_DESCRIPTOR_STRIDE_BYTES(b,1); + ycount = GFC_DESCRIPTOR_EXTENT(b,1); } for (y = 0; y < ycount; y++) diff --git a/libgfortran/m4/pack.m4 b/libgfortran/m4/pack.m4 index 16b8073..910ffdc 100644 --- a/libgfortran/m4/pack.m4 +++ b/libgfortran/m4/pack.m4 @@ -123,11 +123,11 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(array,n); if (extent[n] <= 0) zero_sized = 1; - sstride[n] = array->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (sstride[0] == 0) sstride[0] = 1; @@ -148,7 +148,7 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array, { /* The return array will have as many elements as there are in VECTOR. */ - total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + total = GFC_DESCRIPTOR_EXTENT(vector,0); if (total < 0) { total = 0; @@ -216,9 +216,7 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array, if (ret->data == NULL) { /* Setup the array descriptor. */ - ret->dim[0].lbound = 0; - ret->dim[0].ubound = total - 1; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; if (total == 0) @@ -235,7 +233,7 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array, /* We come here because of range checking. */ index_type ret_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); if (total != ret_extent) runtime_error ("Incorrect extent in return value of PACK intrinsic;" " is %ld, should be %ld", (long int) total, @@ -243,7 +241,7 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array, } } - rstride0 = ret->dim[0].stride; + rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0); if (rstride0 == 0) rstride0 = 1; sstride0 = sstride[0]; @@ -292,11 +290,11 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array, /* Add any remaining elements from VECTOR. */ if (vector) { - n = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + n = GFC_DESCRIPTOR_EXTENT(vector,0); nelem = ((rptr - ret->data) / rstride0); if (n > nelem) { - sstride0 = vector->dim[0].stride; + sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (sstride0 == 0) sstride0 = 1; diff --git a/libgfortran/m4/reshape.m4 b/libgfortran/m4/reshape.m4 index 5240e38..4052a5e 100644 --- a/libgfortran/m4/reshape.m4 +++ b/libgfortran/m4/reshape.m4 @@ -1,4 +1,4 @@ -`/* Implementation of the RESHAPE +`/* Implementation of the RESHAPE intrinsic Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -83,7 +83,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, int sempty, pempty, shape_empty; index_type shape_data[GFC_MAX_DIMENSIONS]; - rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1; + rdim = GFC_DESCRIPTOR_EXTENT(shape,0); if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -91,7 +91,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, for (n = 0; n < rdim; n++) { - shape_data[n] = shape->data[n * shape->dim[0].stride]; + shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)]; if (shape_data[n] <= 0) { shape_data[n] = 0; @@ -104,10 +104,10 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, rs = 1; for (n = 0; n < rdim; n++) { - ret->dim[n].lbound = 0; rex = shape_data[n]; - ret->dim[n].ubound = rex - 1; - ret->dim[n].stride = rs; + + GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs); + rs *= rex; } ret->offset = 0; @@ -126,8 +126,8 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, for (n = 0; n < pdim; n++) { pcount[n] = 0; - pstride[n] = pad->dim[n].stride; - pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound; + pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n); + pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n); if (pextent[n] <= 0) { pempty = 1; @@ -157,7 +157,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, for (n = 0; n < rdim; n++) { rs *= shape_data[n]; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (ret_extent != shape_data[n]) runtime_error("Incorrect extent in return value of RESHAPE" " intrinsic in dimension %ld: is %ld," @@ -170,7 +170,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, for (n = 0; n < sdim; n++) { index_type se; - se = source->dim[n].ubound + 1 - source->dim[0].lbound; + se = GFC_DESCRIPTOR_EXTENT(source,n); source_extent *= se > 0 ? se : 0; } @@ -189,7 +189,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, for (n = 0; n < rdim; n++) { - v = order->data[n * order->dim[0].stride] - 1; + v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; if (v < 0 || v >= rdim) runtime_error("Value %ld out of range in ORDER argument" @@ -208,13 +208,13 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, for (n = 0; n < rdim; n++) { if (order) - dim = order->data[n * order->dim[0].stride] - 1; + dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1; else dim = n; rcount[n] = 0; - rstride[n] = ret->dim[dim].stride; - rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim); + rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim); if (rextent[n] < 0) rextent[n] = 0; @@ -235,8 +235,8 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, for (n = 0; n < sdim; n++) { scount[n] = 0; - sstride[n] = source->dim[n].stride; - sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (sextent[n] <= 0) { sempty = 1; diff --git a/libgfortran/m4/shape.m4 b/libgfortran/m4/shape.m4 index b189f80..eadd3b9 100644 --- a/libgfortran/m4/shape.m4 +++ b/libgfortran/m4/shape.m4 @@ -43,14 +43,14 @@ shape_'rtype_kind` ('rtype` * const restrict ret, index_type stride; index_type extent; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); - if (ret->dim[0].ubound < ret->dim[0].lbound) + if (GFC_DESCRIPTOR_EXTENT(ret,0) < 1) return; for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++) { - extent = array->dim[n].ubound + 1 - array->dim[n].lbound; + extent = GFC_DESCRIPTOR_EXTENT(array,n); ret->data[n * stride] = extent > 0 ? extent : 0 ; } } diff --git a/libgfortran/m4/spread.m4 b/libgfortran/m4/spread.m4 index 84ea00c..5e73d97 100644 --- a/libgfortran/m4/spread.m4 +++ b/libgfortran/m4/spread.m4 @@ -70,6 +70,9 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source, if (ret->data == NULL) { + + size_t ub, stride; + /* The front end has signalled that we need to populate the return array descriptor. */ ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank; @@ -77,26 +80,25 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source, rs = 1; for (n = 0; n < rrank; n++) { - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; + stride = rs; if (n == along - 1) { - ret->dim[n].ubound = ncopies - 1; + ub = ncopies - 1; rdelta = rs; rs *= ncopies; } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; - sstride[dim] = source->dim[dim].stride; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); rstride[dim] = rs; - ret->dim[n].ubound = extent[dim]-1; + ub = extent[dim] - 1; rs *= extent[dim]; dim++; } + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; if (rs > 0) @@ -123,10 +125,10 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source, { index_type ret_extent; - ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n); if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); if (ret_extent != ncopies) runtime_error("Incorrect extent in return value of SPREAD" @@ -137,8 +139,7 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source, else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (ret_extent != extent[dim]) runtime_error("Incorrect extent in return value of SPREAD" " intrinsic in dimension %ld: is %ld," @@ -148,8 +149,8 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source, if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -160,17 +161,16 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source, { if (n == along - 1) { - rdelta = ret->dim[n].stride; + rdelta = GFC_DESCRIPTOR_STRIDE(ret,n); } else { count[dim] = 0; - extent[dim] = source->dim[dim].ubound + 1 - - source->dim[dim].lbound; + extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim); if (extent[dim] <= 0) zero_sized = 1; - sstride[dim] = source->dim[dim].stride; - rstride[dim] = ret->dim[n].stride; + sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim); + rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n); dim++; } } @@ -249,19 +249,17 @@ spread_scalar_'rtype_code` ('rtype` *ret, const 'rtype_name` *source, { ret->data = internal_malloc_size (ncopies * sizeof ('rtype_name`)); ret->offset = 0; - ret->dim[0].stride = 1; - ret->dim[0].lbound = 0; - ret->dim[0].ubound = ncopies - 1; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } else { - if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound) - / ret->dim[0].stride) + if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1) + / GFC_DESCRIPTOR_STRIDE(ret,0)) runtime_error ("dim too large in spread()"); } dest = ret->data; - stride = ret->dim[0].stride; + stride = GFC_DESCRIPTOR_STRIDE(ret,0); for (n = 0; n < ncopies; n++) { diff --git a/libgfortran/m4/transpose.m4 b/libgfortran/m4/transpose.m4 index 8c50767..34c2d6c 100644 --- a/libgfortran/m4/transpose.m4 +++ b/libgfortran/m4/transpose.m4 @@ -55,13 +55,11 @@ transpose_'rtype_code` ('rtype` * const restrict ret, assert (GFC_DESCRIPTOR_RANK (ret) == 2); assert (ret->dtype == source->dtype); - ret->dim[0].lbound = 0; - ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound; - ret->dim[0].stride = 1; + GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1, + 1); - ret->dim[1].lbound = 0; - ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound; - ret->dim[1].stride = ret->dim[0].ubound+1; + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); ret->data = internal_malloc_size (sizeof ('rtype_name`) * size0 ((array_t *) ret)); ret->offset = 0; @@ -69,8 +67,8 @@ transpose_'rtype_code` ('rtype` * const restrict ret, { index_type ret_extent, src_extent; - ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound; - src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0); + src_extent = GFC_DESCRIPTOR_EXTENT(source,1); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -78,8 +76,8 @@ transpose_'rtype_code` ('rtype` * const restrict ret, " should be %ld", (long int) src_extent, (long int) ret_extent); - ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound; - src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound; + ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1); + src_extent = GFC_DESCRIPTOR_EXTENT(source,0); if (src_extent != ret_extent) runtime_error ("Incorrect extent in return value of TRANSPOSE" @@ -89,13 +87,13 @@ transpose_'rtype_code` ('rtype` * const restrict ret, } - sxstride = source->dim[0].stride; - systride = source->dim[1].stride; - xcount = source->dim[0].ubound + 1 - source->dim[0].lbound; - ycount = source->dim[1].ubound + 1 - source->dim[1].lbound; + sxstride = GFC_DESCRIPTOR_STRIDE(source,0); + systride = GFC_DESCRIPTOR_STRIDE(source,1); + xcount = GFC_DESCRIPTOR_EXTENT(source,0); + ycount = GFC_DESCRIPTOR_EXTENT(source,1); - rxstride = ret->dim[0].stride; - rystride = ret->dim[1].stride; + rxstride = GFC_DESCRIPTOR_STRIDE(ret,0); + rystride = GFC_DESCRIPTOR_STRIDE(ret,1); rptr = ret->data; sptr = source->data; diff --git a/libgfortran/m4/unpack.m4 b/libgfortran/m4/unpack.m4 index a26128c..bf348ae 100644 --- a/libgfortran/m4/unpack.m4 +++ b/libgfortran/m4/unpack.m4 @@ -91,13 +91,12 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -109,10 +108,10 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -124,7 +123,7 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; @@ -236,14 +235,13 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector, for (n = 0; n < dim; n++) { count[n] = 0; - ret->dim[n].stride = rs; - ret->dim[n].lbound = 0; - ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound; - extent[n] = ret->dim[n].ubound + 1; + GFC_DIMENSION_SET(ret->dim[n], 0, + GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs); + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); rs *= extent[n]; } ret->offset = 0; @@ -255,11 +253,11 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector, for (n = 0; n < dim; n++) { count[n] = 0; - extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound; + extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n); empty = empty || extent[n] <= 0; - rstride[n] = ret->dim[n].stride; - fstride[n] = field->dim[n].stride; - mstride[n] = mask->dim[n].stride * mask_kind; + rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n); + fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n); + mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n); } if (rstride[0] == 0) rstride[0] = 1; @@ -273,7 +271,7 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector, if (mstride[0] == 0) mstride[0] = 1; - vstride0 = vector->dim[0].stride; + vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0); if (vstride0 == 0) vstride0 = 1; rstride0 = rstride[0]; diff --git a/libgfortran/runtime/in_pack_generic.c b/libgfortran/runtime/in_pack_generic.c index 28e8d8e..33ce031 100644 --- a/libgfortran/runtime/in_pack_generic.c +++ b/libgfortran/runtime/in_pack_generic.c @@ -48,12 +48,6 @@ internal_pack (gfc_array_char * source) index_type size; index_type type_size; - if (source->dim[0].stride == 0) - { - source->dim[0].stride = 1; - return source->data; - } - type_size = GFC_DTYPE_TYPE_SIZE(source); size = GFC_DESCRIPTOR_SIZE (source); switch (type_size) @@ -147,8 +141,8 @@ internal_pack (gfc_array_char * source) for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = source->dim[n].stride; - extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(source,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(source,n); if (extent[n] <= 0) { /* Do nothing. */ diff --git a/libgfortran/runtime/in_unpack_generic.c b/libgfortran/runtime/in_unpack_generic.c index 66b5c84..3c290cd 100644 --- a/libgfortran/runtime/in_unpack_generic.c +++ b/libgfortran/runtime/in_unpack_generic.c @@ -162,16 +162,13 @@ internal_unpack (gfc_array_char * d, const void * s) size = GFC_DESCRIPTOR_SIZE (d); - if (d->dim[0].stride == 0) - d->dim[0].stride = 1; - dim = GFC_DESCRIPTOR_RANK (d); dsize = 1; for (n = 0; n < dim; n++) { count[n] = 0; - stride[n] = d->dim[n].stride; - extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound; + stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); + extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; |