summaryrefslogtreecommitdiff
path: root/libgfortran/generated
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-21 19:24:55 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-21 19:24:55 +0000
commit827aef63c4ec0ed551bd722b147d88e485585eb9 (patch)
tree0f6ecc4005b1035630f9b5894ef6e31b9a0fc204 /libgfortran/generated
parent0a77b1e6f3e1fc1bfe6379f179c3f49dcc44e626 (diff)
downloadgcc-827aef63c4ec0ed551bd722b147d88e485585eb9.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148769 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/generated')
-rw-r--r--libgfortran/generated/all_l1.c34
-rw-r--r--libgfortran/generated/all_l16.c34
-rw-r--r--libgfortran/generated/all_l2.c34
-rw-r--r--libgfortran/generated/all_l4.c34
-rw-r--r--libgfortran/generated/all_l8.c34
-rw-r--r--libgfortran/generated/any_l1.c34
-rw-r--r--libgfortran/generated/any_l16.c34
-rw-r--r--libgfortran/generated/any_l2.c34
-rw-r--r--libgfortran/generated/any_l4.c34
-rw-r--r--libgfortran/generated/any_l8.c34
-rw-r--r--libgfortran/generated/count_16_l.c34
-rw-r--r--libgfortran/generated/count_1_l.c34
-rw-r--r--libgfortran/generated/count_2_l.c34
-rw-r--r--libgfortran/generated/count_4_l.c34
-rw-r--r--libgfortran/generated/count_8_l.c34
-rw-r--r--libgfortran/generated/cshift0_c10.c12
-rw-r--r--libgfortran/generated/cshift0_c16.c12
-rw-r--r--libgfortran/generated/cshift0_c4.c12
-rw-r--r--libgfortran/generated/cshift0_c8.c12
-rw-r--r--libgfortran/generated/cshift0_i1.c12
-rw-r--r--libgfortran/generated/cshift0_i16.c12
-rw-r--r--libgfortran/generated/cshift0_i2.c12
-rw-r--r--libgfortran/generated/cshift0_i4.c12
-rw-r--r--libgfortran/generated/cshift0_i8.c12
-rw-r--r--libgfortran/generated/cshift0_r10.c12
-rw-r--r--libgfortran/generated/cshift0_r16.c12
-rw-r--r--libgfortran/generated/cshift0_r4.c12
-rw-r--r--libgfortran/generated/cshift0_r8.c12
-rw-r--r--libgfortran/generated/cshift1_16.c42
-rw-r--r--libgfortran/generated/cshift1_4.c42
-rw-r--r--libgfortran/generated/cshift1_8.c42
-rw-r--r--libgfortran/generated/eoshift1_16.c43
-rw-r--r--libgfortran/generated/eoshift1_4.c43
-rw-r--r--libgfortran/generated/eoshift1_8.c43
-rw-r--r--libgfortran/generated/eoshift3_16.c45
-rw-r--r--libgfortran/generated/eoshift3_4.c45
-rw-r--r--libgfortran/generated/eoshift3_8.c45
-rw-r--r--libgfortran/generated/in_pack_c10.c4
-rw-r--r--libgfortran/generated/in_pack_c16.c4
-rw-r--r--libgfortran/generated/in_pack_c4.c4
-rw-r--r--libgfortran/generated/in_pack_c8.c4
-rw-r--r--libgfortran/generated/in_pack_i1.c4
-rw-r--r--libgfortran/generated/in_pack_i16.c4
-rw-r--r--libgfortran/generated/in_pack_i2.c4
-rw-r--r--libgfortran/generated/in_pack_i4.c4
-rw-r--r--libgfortran/generated/in_pack_i8.c4
-rw-r--r--libgfortran/generated/in_pack_r10.c4
-rw-r--r--libgfortran/generated/in_pack_r16.c4
-rw-r--r--libgfortran/generated/in_pack_r4.c4
-rw-r--r--libgfortran/generated/in_pack_r8.c4
-rw-r--r--libgfortran/generated/in_unpack_c10.c4
-rw-r--r--libgfortran/generated/in_unpack_c16.c4
-rw-r--r--libgfortran/generated/in_unpack_c4.c4
-rw-r--r--libgfortran/generated/in_unpack_c8.c4
-rw-r--r--libgfortran/generated/in_unpack_i1.c4
-rw-r--r--libgfortran/generated/in_unpack_i16.c4
-rw-r--r--libgfortran/generated/in_unpack_i2.c4
-rw-r--r--libgfortran/generated/in_unpack_i4.c4
-rw-r--r--libgfortran/generated/in_unpack_i8.c4
-rw-r--r--libgfortran/generated/in_unpack_r10.c4
-rw-r--r--libgfortran/generated/in_unpack_r16.c4
-rw-r--r--libgfortran/generated/in_unpack_r4.c4
-rw-r--r--libgfortran/generated/in_unpack_r8.c4
-rw-r--r--libgfortran/generated/matmul_c10.c67
-rw-r--r--libgfortran/generated/matmul_c16.c67
-rw-r--r--libgfortran/generated/matmul_c4.c67
-rw-r--r--libgfortran/generated/matmul_c8.c67
-rw-r--r--libgfortran/generated/matmul_i1.c67
-rw-r--r--libgfortran/generated/matmul_i16.c67
-rw-r--r--libgfortran/generated/matmul_i2.c67
-rw-r--r--libgfortran/generated/matmul_i4.c67
-rw-r--r--libgfortran/generated/matmul_i8.c67
-rw-r--r--libgfortran/generated/matmul_l16.c69
-rw-r--r--libgfortran/generated/matmul_l4.c69
-rw-r--r--libgfortran/generated/matmul_l8.c69
-rw-r--r--libgfortran/generated/matmul_r10.c67
-rw-r--r--libgfortran/generated/matmul_r16.c67
-rw-r--r--libgfortran/generated/matmul_r4.c67
-rw-r--r--libgfortran/generated/matmul_r8.c67
-rw-r--r--libgfortran/generated/maxloc0_16_i1.c38
-rw-r--r--libgfortran/generated/maxloc0_16_i16.c38
-rw-r--r--libgfortran/generated/maxloc0_16_i2.c38
-rw-r--r--libgfortran/generated/maxloc0_16_i4.c38
-rw-r--r--libgfortran/generated/maxloc0_16_i8.c38
-rw-r--r--libgfortran/generated/maxloc0_16_r10.c38
-rw-r--r--libgfortran/generated/maxloc0_16_r16.c38
-rw-r--r--libgfortran/generated/maxloc0_16_r4.c38
-rw-r--r--libgfortran/generated/maxloc0_16_r8.c38
-rw-r--r--libgfortran/generated/maxloc0_4_i1.c38
-rw-r--r--libgfortran/generated/maxloc0_4_i16.c38
-rw-r--r--libgfortran/generated/maxloc0_4_i2.c38
-rw-r--r--libgfortran/generated/maxloc0_4_i4.c38
-rw-r--r--libgfortran/generated/maxloc0_4_i8.c38
-rw-r--r--libgfortran/generated/maxloc0_4_r10.c38
-rw-r--r--libgfortran/generated/maxloc0_4_r16.c38
-rw-r--r--libgfortran/generated/maxloc0_4_r4.c38
-rw-r--r--libgfortran/generated/maxloc0_4_r8.c38
-rw-r--r--libgfortran/generated/maxloc0_8_i1.c38
-rw-r--r--libgfortran/generated/maxloc0_8_i16.c38
-rw-r--r--libgfortran/generated/maxloc0_8_i2.c38
-rw-r--r--libgfortran/generated/maxloc0_8_i4.c38
-rw-r--r--libgfortran/generated/maxloc0_8_i8.c38
-rw-r--r--libgfortran/generated/maxloc0_8_r10.c38
-rw-r--r--libgfortran/generated/maxloc0_8_r16.c38
-rw-r--r--libgfortran/generated/maxloc0_8_r4.c38
-rw-r--r--libgfortran/generated/maxloc0_8_r8.c38
-rw-r--r--libgfortran/generated/maxloc1_16_i1.c108
-rw-r--r--libgfortran/generated/maxloc1_16_i16.c108
-rw-r--r--libgfortran/generated/maxloc1_16_i2.c108
-rw-r--r--libgfortran/generated/maxloc1_16_i4.c108
-rw-r--r--libgfortran/generated/maxloc1_16_i8.c108
-rw-r--r--libgfortran/generated/maxloc1_16_r10.c108
-rw-r--r--libgfortran/generated/maxloc1_16_r16.c108
-rw-r--r--libgfortran/generated/maxloc1_16_r4.c108
-rw-r--r--libgfortran/generated/maxloc1_16_r8.c108
-rw-r--r--libgfortran/generated/maxloc1_4_i1.c108
-rw-r--r--libgfortran/generated/maxloc1_4_i16.c108
-rw-r--r--libgfortran/generated/maxloc1_4_i2.c108
-rw-r--r--libgfortran/generated/maxloc1_4_i4.c108
-rw-r--r--libgfortran/generated/maxloc1_4_i8.c108
-rw-r--r--libgfortran/generated/maxloc1_4_r10.c108
-rw-r--r--libgfortran/generated/maxloc1_4_r16.c108
-rw-r--r--libgfortran/generated/maxloc1_4_r4.c108
-rw-r--r--libgfortran/generated/maxloc1_4_r8.c108
-rw-r--r--libgfortran/generated/maxloc1_8_i1.c108
-rw-r--r--libgfortran/generated/maxloc1_8_i16.c108
-rw-r--r--libgfortran/generated/maxloc1_8_i2.c108
-rw-r--r--libgfortran/generated/maxloc1_8_i4.c108
-rw-r--r--libgfortran/generated/maxloc1_8_i8.c108
-rw-r--r--libgfortran/generated/maxloc1_8_r10.c108
-rw-r--r--libgfortran/generated/maxloc1_8_r16.c108
-rw-r--r--libgfortran/generated/maxloc1_8_r4.c108
-rw-r--r--libgfortran/generated/maxloc1_8_r8.c108
-rw-r--r--libgfortran/generated/maxval_i1.c108
-rw-r--r--libgfortran/generated/maxval_i16.c108
-rw-r--r--libgfortran/generated/maxval_i2.c108
-rw-r--r--libgfortran/generated/maxval_i4.c108
-rw-r--r--libgfortran/generated/maxval_i8.c108
-rw-r--r--libgfortran/generated/maxval_r10.c108
-rw-r--r--libgfortran/generated/maxval_r16.c108
-rw-r--r--libgfortran/generated/maxval_r4.c108
-rw-r--r--libgfortran/generated/maxval_r8.c108
-rw-r--r--libgfortran/generated/minloc0_16_i1.c38
-rw-r--r--libgfortran/generated/minloc0_16_i16.c38
-rw-r--r--libgfortran/generated/minloc0_16_i2.c38
-rw-r--r--libgfortran/generated/minloc0_16_i4.c38
-rw-r--r--libgfortran/generated/minloc0_16_i8.c38
-rw-r--r--libgfortran/generated/minloc0_16_r10.c38
-rw-r--r--libgfortran/generated/minloc0_16_r16.c38
-rw-r--r--libgfortran/generated/minloc0_16_r4.c38
-rw-r--r--libgfortran/generated/minloc0_16_r8.c38
-rw-r--r--libgfortran/generated/minloc0_4_i1.c38
-rw-r--r--libgfortran/generated/minloc0_4_i16.c38
-rw-r--r--libgfortran/generated/minloc0_4_i2.c38
-rw-r--r--libgfortran/generated/minloc0_4_i4.c38
-rw-r--r--libgfortran/generated/minloc0_4_i8.c38
-rw-r--r--libgfortran/generated/minloc0_4_r10.c38
-rw-r--r--libgfortran/generated/minloc0_4_r16.c38
-rw-r--r--libgfortran/generated/minloc0_4_r4.c38
-rw-r--r--libgfortran/generated/minloc0_4_r8.c38
-rw-r--r--libgfortran/generated/minloc0_8_i1.c38
-rw-r--r--libgfortran/generated/minloc0_8_i16.c38
-rw-r--r--libgfortran/generated/minloc0_8_i2.c38
-rw-r--r--libgfortran/generated/minloc0_8_i4.c38
-rw-r--r--libgfortran/generated/minloc0_8_i8.c38
-rw-r--r--libgfortran/generated/minloc0_8_r10.c38
-rw-r--r--libgfortran/generated/minloc0_8_r16.c38
-rw-r--r--libgfortran/generated/minloc0_8_r4.c38
-rw-r--r--libgfortran/generated/minloc0_8_r8.c38
-rw-r--r--libgfortran/generated/minloc1_16_i1.c108
-rw-r--r--libgfortran/generated/minloc1_16_i16.c108
-rw-r--r--libgfortran/generated/minloc1_16_i2.c108
-rw-r--r--libgfortran/generated/minloc1_16_i4.c108
-rw-r--r--libgfortran/generated/minloc1_16_i8.c108
-rw-r--r--libgfortran/generated/minloc1_16_r10.c108
-rw-r--r--libgfortran/generated/minloc1_16_r16.c108
-rw-r--r--libgfortran/generated/minloc1_16_r4.c108
-rw-r--r--libgfortran/generated/minloc1_16_r8.c108
-rw-r--r--libgfortran/generated/minloc1_4_i1.c108
-rw-r--r--libgfortran/generated/minloc1_4_i16.c108
-rw-r--r--libgfortran/generated/minloc1_4_i2.c108
-rw-r--r--libgfortran/generated/minloc1_4_i4.c108
-rw-r--r--libgfortran/generated/minloc1_4_i8.c108
-rw-r--r--libgfortran/generated/minloc1_4_r10.c108
-rw-r--r--libgfortran/generated/minloc1_4_r16.c108
-rw-r--r--libgfortran/generated/minloc1_4_r4.c108
-rw-r--r--libgfortran/generated/minloc1_4_r8.c108
-rw-r--r--libgfortran/generated/minloc1_8_i1.c108
-rw-r--r--libgfortran/generated/minloc1_8_i16.c108
-rw-r--r--libgfortran/generated/minloc1_8_i2.c108
-rw-r--r--libgfortran/generated/minloc1_8_i4.c108
-rw-r--r--libgfortran/generated/minloc1_8_i8.c108
-rw-r--r--libgfortran/generated/minloc1_8_r10.c108
-rw-r--r--libgfortran/generated/minloc1_8_r16.c108
-rw-r--r--libgfortran/generated/minloc1_8_r4.c108
-rw-r--r--libgfortran/generated/minloc1_8_r8.c108
-rw-r--r--libgfortran/generated/minval_i1.c108
-rw-r--r--libgfortran/generated/minval_i16.c108
-rw-r--r--libgfortran/generated/minval_i2.c108
-rw-r--r--libgfortran/generated/minval_i4.c108
-rw-r--r--libgfortran/generated/minval_i8.c108
-rw-r--r--libgfortran/generated/minval_r10.c108
-rw-r--r--libgfortran/generated/minval_r16.c108
-rw-r--r--libgfortran/generated/minval_r4.c108
-rw-r--r--libgfortran/generated/minval_r8.c108
-rw-r--r--libgfortran/generated/pack_c10.c20
-rw-r--r--libgfortran/generated/pack_c16.c20
-rw-r--r--libgfortran/generated/pack_c4.c20
-rw-r--r--libgfortran/generated/pack_c8.c20
-rw-r--r--libgfortran/generated/pack_i1.c20
-rw-r--r--libgfortran/generated/pack_i16.c20
-rw-r--r--libgfortran/generated/pack_i2.c20
-rw-r--r--libgfortran/generated/pack_i4.c20
-rw-r--r--libgfortran/generated/pack_i8.c20
-rw-r--r--libgfortran/generated/pack_r10.c20
-rw-r--r--libgfortran/generated/pack_r16.c20
-rw-r--r--libgfortran/generated/pack_r4.c20
-rw-r--r--libgfortran/generated/pack_r8.c20
-rw-r--r--libgfortran/generated/product_c10.c108
-rw-r--r--libgfortran/generated/product_c16.c108
-rw-r--r--libgfortran/generated/product_c4.c108
-rw-r--r--libgfortran/generated/product_c8.c108
-rw-r--r--libgfortran/generated/product_i1.c108
-rw-r--r--libgfortran/generated/product_i16.c108
-rw-r--r--libgfortran/generated/product_i2.c108
-rw-r--r--libgfortran/generated/product_i4.c108
-rw-r--r--libgfortran/generated/product_i8.c108
-rw-r--r--libgfortran/generated/product_r10.c108
-rw-r--r--libgfortran/generated/product_r16.c108
-rw-r--r--libgfortran/generated/product_r4.c108
-rw-r--r--libgfortran/generated/product_r8.c108
-rw-r--r--libgfortran/generated/reshape_c10.c32
-rw-r--r--libgfortran/generated/reshape_c16.c32
-rw-r--r--libgfortran/generated/reshape_c4.c32
-rw-r--r--libgfortran/generated/reshape_c8.c32
-rw-r--r--libgfortran/generated/reshape_i16.c32
-rw-r--r--libgfortran/generated/reshape_i4.c32
-rw-r--r--libgfortran/generated/reshape_i8.c32
-rw-r--r--libgfortran/generated/reshape_r10.c32
-rw-r--r--libgfortran/generated/reshape_r16.c32
-rw-r--r--libgfortran/generated/reshape_r4.c32
-rw-r--r--libgfortran/generated/reshape_r8.c32
-rw-r--r--libgfortran/generated/shape_i16.c6
-rw-r--r--libgfortran/generated/shape_i4.c6
-rw-r--r--libgfortran/generated/shape_i8.c6
-rw-r--r--libgfortran/generated/spread_c10.c46
-rw-r--r--libgfortran/generated/spread_c16.c46
-rw-r--r--libgfortran/generated/spread_c4.c46
-rw-r--r--libgfortran/generated/spread_c8.c46
-rw-r--r--libgfortran/generated/spread_i1.c46
-rw-r--r--libgfortran/generated/spread_i16.c46
-rw-r--r--libgfortran/generated/spread_i2.c46
-rw-r--r--libgfortran/generated/spread_i4.c46
-rw-r--r--libgfortran/generated/spread_i8.c46
-rw-r--r--libgfortran/generated/spread_r10.c46
-rw-r--r--libgfortran/generated/spread_r16.c46
-rw-r--r--libgfortran/generated/spread_r4.c46
-rw-r--r--libgfortran/generated/spread_r8.c46
-rw-r--r--libgfortran/generated/sum_c10.c108
-rw-r--r--libgfortran/generated/sum_c16.c108
-rw-r--r--libgfortran/generated/sum_c4.c108
-rw-r--r--libgfortran/generated/sum_c8.c108
-rw-r--r--libgfortran/generated/sum_i1.c108
-rw-r--r--libgfortran/generated/sum_i16.c108
-rw-r--r--libgfortran/generated/sum_i2.c108
-rw-r--r--libgfortran/generated/sum_i4.c108
-rw-r--r--libgfortran/generated/sum_i8.c108
-rw-r--r--libgfortran/generated/sum_r10.c108
-rw-r--r--libgfortran/generated/sum_r16.c108
-rw-r--r--libgfortran/generated/sum_r4.c108
-rw-r--r--libgfortran/generated/sum_r8.c108
-rw-r--r--libgfortran/generated/transpose_c10.c30
-rw-r--r--libgfortran/generated/transpose_c16.c30
-rw-r--r--libgfortran/generated/transpose_c4.c30
-rw-r--r--libgfortran/generated/transpose_c8.c30
-rw-r--r--libgfortran/generated/transpose_i16.c30
-rw-r--r--libgfortran/generated/transpose_i4.c30
-rw-r--r--libgfortran/generated/transpose_i8.c30
-rw-r--r--libgfortran/generated/transpose_r10.c30
-rw-r--r--libgfortran/generated/transpose_r16.c30
-rw-r--r--libgfortran/generated/transpose_r4.c30
-rw-r--r--libgfortran/generated/transpose_r8.c30
-rw-r--r--libgfortran/generated/unpack_c10.c42
-rw-r--r--libgfortran/generated/unpack_c16.c42
-rw-r--r--libgfortran/generated/unpack_c4.c42
-rw-r--r--libgfortran/generated/unpack_c8.c42
-rw-r--r--libgfortran/generated/unpack_i1.c42
-rw-r--r--libgfortran/generated/unpack_i16.c42
-rw-r--r--libgfortran/generated/unpack_i2.c42
-rw-r--r--libgfortran/generated/unpack_i4.c42
-rw-r--r--libgfortran/generated/unpack_i8.c42
-rw-r--r--libgfortran/generated/unpack_r10.c42
-rw-r--r--libgfortran/generated/unpack_r16.c42
-rw-r--r--libgfortran/generated/unpack_r4.c42
-rw-r--r--libgfortran/generated/unpack_r8.c42
295 files changed, 8072 insertions, 8906 deletions
diff --git a/libgfortran/generated/all_l1.c b/libgfortran/generated/all_l1.c
index afde913e73f..486bab2e436 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 422fb894dd5..35f8a9621b4 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 00f0886cb36..81532ea431b 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 500d4a52c11..6657e15cd89 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 90f287ccd34..4c3d5563f83 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 0186730a80d..a69f22e6f82 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 13f78a0075e..b5ab5b214ac 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 b37d9cb58b7..05673e8daba 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 b157812964d..8f82741701f 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 f66b00f41bf..2a094f0a5fe 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 c0a488e478d..8c3fc7d9a16 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 a2368975923..faf9176943c 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 7ae90f24d7f..0d1a22339e9 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 75f0f582dd5..d4bfbd47ef3 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 da53d1cd240..2a62ea87bd4 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 1f8078d2fad..16c113deb60 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 83afa517c1b..df83ccb85f4 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 32a60063aeb..52d277f1ce3 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 a9d152d6426..9b9c3b2acce 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 539af355b31..7ed44bddb78 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 fa48d41b7dd..145724b6e81 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 af07c01507c..df332817557 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 1997b1842f6..a1e118589c5 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 6144d61e034..cbe13f153f3 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 b3d5f8e4819..8ba544d2d8e 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 3088da414da..0725048c2ab 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 176be1fdda1..515c36b41fc 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 7947ff9aaad..5a721e49589 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 7a7d0db1dac..df97dfa6b76 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 c6f124fe1f7..f048e8e401f 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 54e92dbcff8..9667728f392 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 b9fe9c311fc..02365cc2375 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 0510d2cd1e8..e703db47786 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 d61023e540f..f8922b344a5 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 282409e2fe0..c3efae9acbf 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 a16594506c8..5038c0916bd 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 5942de5ea06..f745a1d268f 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 afe5ba1835a..97ce9d1eaad 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 c60c6870e72..74e3cb67d58 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 a117f7ac4ea..ae52bc68940 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 f57f2aae130..142ad99cdf7 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 1378f89e73c..dc26c1af6df 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 eced9242c66..32ce3a4ea3e 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 5cb89fc124b..3c39f8e610f 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 7b97b2061e1..4cd7dba479a 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 2a8f6d72e21..17acc684f1d 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 1f283f3d0cb..557ccc2aae7 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 6c7c79e472c..b737cc7d22c 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 372f0871957..68a7e5a0dca 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 09a25445f32..1453f86b582 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 46ce8d446fd..bcac6e7a5d4 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 1b783bd725a..1d09a800690 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 fcf2abb7b79..9ad8a33102f 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 994b234a80e..6adae640e5e 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 323b6847a8d..e632816c918 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 04b2248876f..c7199207e2a 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 cdcd9eaa22c..ec0c1c3aca9 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 837e35c146f..ce5d29df760 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 7ea8b94c708..347f0116cfc 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 15c46b2d07d..aa5f08eb25b 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 af61dfe8e23..0b08228ce70 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 abf8aea6982..f436c8afa85 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 bba3fc6e815..76aff2e5925 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 7d4e47061e0..c54c78ed435 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 4665bcc9530..880c0e12782 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 6c7c723f7fe..020033a770c 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 cf1142ba06a..1522dcd5a19 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 502676a42a6..db56678510c 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 5b2b05a7944..f607e27b81c 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 bf04fce96dc..58e340b7722 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 7b3ba687151..46ed493d0e0 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 45b99c3a3b2..54ffe6248f4 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 fc8e54834e0..5fbeeb7da1d 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 c7bb5844940..19ca9f1e577 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 1d1541033b2..558ed252e26 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 90338ac2807..8e325549ce5 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 a8422b37a41..c11553180d2 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 0bb50350980..54208725dfb 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 0a07243d90e..72ad1fd58f0 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 b5efcedef66..b43f08337c7 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 617813253b6..26941a741f9 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 c7489a05b8f..e1d329c583c 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 17e93bdb0f5..4d1d0a11acd 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 6863d6f5c2e..12147a0e2fa 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 153fc2b183e..33c73083cc7 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 1596cdc616c..4f4f290fee9 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 a5e33aaff76..86cedb3a420 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 6d645d0dc34..378024bff76 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 e219c9ff104..7475059164c 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 da1f6eabfb7..268f09af8de 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 c20b306f7cf..47fb135c50d 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 2c08c7d5c04..55bc2752131 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 1a43838ba34..f598f050fd4 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 ca041d6dce5..5c99198b201 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 dba5031e9a6..c7609c35dc3 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 fe4b1408053..50f3c3b6d1a 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 5360b2f7ceb..30dc2976c3e 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 061a8a63af4..eb1737d23e3 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 6ef795d035e..6690c2da4b7 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 2c8a376e65b..b9bb230589f 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 d602bb4902b..57781469089 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 a4d250c56dd..ef7dedeb984 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 01ffc9d316c..0c08d8e803a 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 448cd30e747..da61d2b6983 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 971e278abda..a26b110220d 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 160f774f3c4..1198d624c54 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 9e1c268e789..a776f4f1c7a 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 3a0a343c338..827b3e6708c 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 4d87d8e145b..24a34e3343f 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 d1ae2f0cae9..0194f28fc27 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 1d60d10dbd4..bb1750028f1 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 e0599714c40..dc8cd5dd425 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 3381560551c..1664edb4b35 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 2defdd1f750..58bfcc0f8ec 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 a3293163dcb..d646d2547f8 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 4281921b25f..39291ff4db3 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 34fcb565d20..059cacb22e5 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 dbd7d2f56e4..64cee3e8725 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 29d04de8eab..f8a843e5c5b 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 823af365ff1..293c2a9cb2e 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 a212e59b5dd..89982795e81 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 db3301c2a82..191ba998242 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 a0099f695e9..1f445e7306a 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 bb7876f2241..170e3dfce1a 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 899b4688c10..9924b718847 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 c5f7272a03f..97946f3dd52 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 f20435aec42..d343b0b36c3 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 ab17f22d967..682de41af38 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 eb72ab68514..e17ecc49915 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 8758d3129a8..cb4b69201ee 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 290929c9538..5a99dafa388 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 a59051ecd26..ba88d8ee418 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 88410eae640..6d05b43051d 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 c190e067b06..10193fdf95d 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 6b872f98cad..884ed6678f2 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 67b8994cd32..3abe6579749 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 e7fb5bc5af7..57aea5fb429 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 b90e1105e56..9d7f57c1cba 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 85851904ff2..2259e8e2be5 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 d9c456646af..7efdd65718c 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 1102d4c7a82..623c25c7f8e 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 ee23df75dbe..bdbb26f06d0 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 e0c6345b12f..961beb924d3 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 1c168542524..7303592131c 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 d289cfcbf66..ee9f46c00b0 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 88a078e6a58..6d07bbe2669 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 b41b5913d0e..bbacc119ec1 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 c79f256bc20..a77efcdc5c7 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 75a9df5faa5..1d29e07f297 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 0fb2966adab..1c451e9f76b 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 317e8be3b1a..d6c70869584 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 363d4a4ae9c..418eb30d240 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 cca045ab5d4..9a23b27e3d8 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 60e2350b6f2..df081acb814 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 94a15e02652..b076dcf5955 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 c556702f113..944694c5c9d 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 62efe8358f6..03b8fd43afb 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 9146890c39c..88059c623fe 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 40d3c58ffe9..0b1e642ba23 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 904811b2521..a6843b1d804 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 9e00f076a4c..5617affe49b 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 bec8fa0c348..bc2454a1367 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 cc46e3f2751..198c9b90cb9 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 9d9a3ba77eb..c62fbcb1166 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 4a57114c480..ffc790088f9 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 6d74ee453a9..68eb7b6ecab 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 8a112f94a74..da7ae066704 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 2f81720b697..fbf5bab98af 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 0e1df47288e..2dd4cfdf406 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 06127ce9e69..5a5ff5e39e2 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 fb0d027b410..25d4ceaae51 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 4a58cc1d39e..228a582ed09 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 549fd25037a..c8652722a86 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 ea4e8543651..fa124441dd6 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 7696c16f1cc..15862a89cb5 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 21cee9085a7..f0b452fa09d 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 b17faefcb54..692259db8c8 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 bdf917c6506..c0189da58f7 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 2a869229210..164f7ec31a2 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 93f7ca2ab7a..899f2029bd3 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 6bc8f5706d2..f900506de74 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 685d242e582..7dedb8f1c5b 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 b3f506a238d..70eaefa8ed6 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 8d93866a009..1a0bdfa7ac1 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 b2909ab97cd..b8849a56d35 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 9741c2bdb6a..cc382dba224 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 4b26710aad9..c36567ffee6 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 b92faa76494..6e46c82b863 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 d9283953c85..8e8410aa669 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 b012f96b2db..2a33e3c1fb7 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 107bf8f6e78..70cdef68bc6 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 16073feb373..c1a01e9e436 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 3acd9c3a8f5..b5a6c8d2d26 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 e194986d5d8..0f4b036461d 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 1e32884c5c1..300b5bebf0d 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 85ad5b73381..da498f661ac 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 f761faa8ad5..437232a89da 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 e0bd7332316..f0bd16fe003 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 bfa14b224c6..08fd3a60b77 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 ba1e592fa06..d7e1ef93966 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 0287e054a78..7b6fdc5e5ae 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 202ae7fd384..1f6a75f0f6c 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 fe4210fb7be..555d86fd66f 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 7dcd5677d23..a7f729ee732 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 e92842f3a7f..69afca1bc50 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 29b1c5bae58..008fb5c9236 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 d8589413e7e..e7d039f5bec 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 5b69c98c8f0..fe1f68d4225 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 2d61cb19a8b..f5a27eca6f5 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 32b04c232c6..edc895082a4 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 36c92525317..8f38a2747ec 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 b510231de6d..149e9f6f67d 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 b350b895c05..dad10d62d46 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 25f088353e8..0a23aa5b72f 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 e1f3041d744..e4bbe6fabcf 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 834ef55b84d..7dff30b7006 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 859e216f568..51d46a27218 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 ba2e60d7519..582c2b9aeb1 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 5fcba7993f4..69f7f8b7026 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 ffa58365150..efaed2cebdb 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 c2301d6f491..505647ecd2e 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 3c36570280d..16c776ad839 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 ab177fae6d4..cbc1ab120af 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 12b0fa4ee66..e3b8c2a07e0 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 b43e871c35d..507d956cb81 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 907fce89da9..d5af3679561 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 3d8869841e4..3308d91dff9 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 9da47228823..7bae90414b6 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 55c2303fa91..bb678725d7c 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 7a66bdc2ff3..333c13d2ffe 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 d120369f7fd..46258c00bbc 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 4a4094cc774..34eff9086a0 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 a2cec54d5da..569b76ce4a8 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 95fbb791ff8..c8b7355de37 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 a34127c8f84..1a390b4509b 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 e40be6079f3..4f69ce0d287 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 4b76fdb30c3..53016bdf597 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 8856e81582a..34620cf6d40 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 3e08b7c6498..3bf319aa434 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 d78df1251e3..6794b506059 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 1577058308e..e7bfbfbf538 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 dcbedb82d37..d0441c0fe5d 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 249793d7db1..9ce28577baa 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 386b84e1641..1b23335de56 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 f0498bc6d71..efe00a5dd33 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 d7e1ee11a45..77a838f01a4 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 d57cdd9014d..1276e4dfb44 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 ddd6305c1a0..5224e8477a9 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 8a32ee4c964..96ecb3afb87 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 e5a2c34f8be..e002c146262 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 a4545576485..bdefdac3271 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 3bcccb190e2..8482cfde857 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 336ca7c958f..6eff6326b26 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 6b10a814199..29312636306 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 9a3a356975b..3c3f197b4c2 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 69ab4c65009..13162609696 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 6f018de8fdf..cc0f1197b69 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 d05e31a92b8..f38ef3885fc 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 a1f658ed416..c63bc695266 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 8ec03a20f85..9871d2d5d6a 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 158e3020fa9..920a6fb4920 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 bc9dc493d68..c3e79237fb3 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 34bbde29955..913d732fa7f 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 1c7d6d94599..060d45aa9ce 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 ffa9846b1cc..5318283ccb8 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 c91cad0c67e..e8c60c3870e 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 de800b266b3..9ee3e934bc7 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 5039e62a9ba..6a283049bfa 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 070e0958a9d..35296c1d0d8 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 24e427a2678..e7e2fe31b3a 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 cb86155fb2d..86ae1092420 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 338998b3c4e..e740d12a7e7 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 2ce91c75d04..31115bdfdde 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 1aa980325a0..a63f62c95ff 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 e901fcb2407..83223940330 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 d61155dde27..f8cfd823f95 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 f835a39aa4d..9b15e470269 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 a6b6333dae3..ddf772b0e42 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 c58ffa20dca..2b2e02d1c98 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 5b5915e9768..4d2e40660fb 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 6cff0097903..1748c1d0561 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 e66a32c7369..09054b6138e 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 91ba77269d7..9b89a5bea79 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 0df76e41b1e..2d9931f02ac 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 f112388328e..116f213f9fc 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 118f2b6a1a3..7298eeceedb 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 974fc319729..f5dcb93df81 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 fb1ee8f0487..77920ea60d8 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 ecb4672441f..c7257bb2f01 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 cd16e579fb0..e3cdde67790 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 422a11c147b..2f720640370 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 7903a3c94ad..796df2edd45 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 d84ccca7a15..b25d2869ac9 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 130acbf53ac..f4b763fc1c5 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 fa809555b04..dc9b4d398ce 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];