summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog452
-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
-rw-r--r--libgfortran/intrinsics/associated.c10
-rw-r--r--libgfortran/intrinsics/cshift0.c54
-rw-r--r--libgfortran/intrinsics/date_and_time.c40
-rw-r--r--libgfortran/intrinsics/dtime.c4
-rw-r--r--libgfortran/intrinsics/eoshift0.c25
-rw-r--r--libgfortran/intrinsics/eoshift2.c42
-rw-r--r--libgfortran/intrinsics/etime.c4
-rw-r--r--libgfortran/intrinsics/iso_c_binding.c37
-rw-r--r--libgfortran/intrinsics/move_alloc.c10
-rw-r--r--libgfortran/intrinsics/pack_generic.c37
-rw-r--r--libgfortran/intrinsics/random.c32
-rw-r--r--libgfortran/intrinsics/reshape_generic.c31
-rw-r--r--libgfortran/intrinsics/size.c4
-rw-r--r--libgfortran/intrinsics/spread_generic.c86
-rw-r--r--libgfortran/intrinsics/stat.c140
-rw-r--r--libgfortran/intrinsics/transpose_generic.c48
-rw-r--r--libgfortran/intrinsics/unpack_generic.c23
-rw-r--r--libgfortran/io/list_read.c21
-rw-r--r--libgfortran/io/transfer.c45
-rw-r--r--libgfortran/io/write.c8
-rw-r--r--libgfortran/libgfortran.h31
-rw-r--r--libgfortran/m4/cshift0.m412
-rw-r--r--libgfortran/m4/cshift1.m442
-rw-r--r--libgfortran/m4/eoshift1.m443
-rw-r--r--libgfortran/m4/eoshift3.m445
-rw-r--r--libgfortran/m4/iforeach.m438
-rw-r--r--libgfortran/m4/ifunction.m4108
-rw-r--r--libgfortran/m4/ifunction_logical.m434
-rw-r--r--libgfortran/m4/in_pack.m44
-rw-r--r--libgfortran/m4/in_unpack.m44
-rw-r--r--libgfortran/m4/matmul.m467
-rw-r--r--libgfortran/m4/matmull.m469
-rw-r--r--libgfortran/m4/pack.m420
-rw-r--r--libgfortran/m4/reshape.m432
-rw-r--r--libgfortran/m4/shape.m46
-rw-r--r--libgfortran/m4/spread.m446
-rw-r--r--libgfortran/m4/transpose.m430
-rw-r--r--libgfortran/m4/unpack.m442
-rw-r--r--libgfortran/runtime/in_pack_generic.c10
-rw-r--r--libgfortran/runtime/in_unpack_generic.c7
336 files changed, 9238 insertions, 9583 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 51065aee4bb..4b4a3535d26 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,455 @@
+2009-06-21 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/37577
+ Port from fortran-dev
+ * runtime/in_pack_generic (internal_pack): Remove unnecessary
+ test for stride == 0.
+ * runtime/in_unpack_generic.c (internal_unpack): Likewise.
+ * intrinsics/iso_c_binding.c (c_f_pointer_u0): Take care
+ of stride in "shape" argument. Use array access macros for
+ accessing array descriptors.
+ * libgfortran.h (struct descriptor_dimension): Change stride
+ to _stride, lbound to _lbound and ubound to _ubound.
+ (GFC_DIMENSION_LBOUND): Use new name(s) in struct
+ descriptor_dimension.
+ (GFC_DIMENSION_UBOUND): Likewise.
+ (GFC_DIMENSION_STRIDE): Likewise.
+ (GFC_DIMENSION_EXTENT): Likewise.
+ (GFC_DIMENSION_SET): Likewise.
+ (GFC_DESCRIPTOR_LBOUND): Likewise.
+ (GFC_DESCRIPTOR_UBOUND): Likewise.
+ (GFC_DESCRIPTOR_EXTENT): Likewise.
+ (GFC_DESCRIPTOR_STRIDE): Likewise.
+ * io/transfer.c (transfer_array): Use array access macros.
+ Use byte-sized strides.
+ * intrinsics/eoshift0.c (eoshift0): Use array access
+ macros everywhere.
+ * m4/in_pack.m4 (internal_pack_'rtype_ccode`): Use
+ array access macros for accessing array descriptors.
+ * m4/in_unpack.m4 (internal_unpack_'rtype_ccode`):
+ Likewise.
+ * m4/matmull.m4 (matmul_'rtype_code`): Likewise.
+ * m4/matmul.m4 (matmul_'rtype_code`): Likewise.
+ * m4/unpack.m4 (unpack0_'rtype_code`): Likewise.
+ (unpack1_'rtype_code`): Likewise.
+ * m4/ifunction_logical.m4 (name`'rtype_qual`_'atype_code): Likewise.
+ * m4/ifunction.m4 (name`'rtype_qual`_'atype_code): Use array access
+ macros everywhere.
+ * intrinsics/dtime.c (dtime_sub): Use array access macros
+ for accessing array descriptors.
+ * intrinsics/cshift0 (cshift0): Likewise.
+ * intrinsics/etime.c: Likewise. Remove redundant calculation
+ of rdim.
+ * m4/cshift0.m4 (cshift0_'rtype_code`): Use array access macros
+ for accessing array descriptors.
+ * m4/pack.m4 (pack_'rtype_code`): Likewise.
+ * m4/spread.m4 (spread_'rtype_code`): Likewise.
+ (spread_scalar_'rtype_code`): Likewise.
+ * m4/transpose.m4 (transpose_'rtype_code`): Likewise.
+ * m4/iforeach.m4 (name`'rtype_qual`_'atype_code): Likewise.
+ * m4/eoshift1.m4 (eoshift1): Likewise. Remove size argument,
+ calculate within function.
+ (eoshift1_'atype_kind`): Remove size argument from call
+ to eoshift1.
+ (eoshift1_'atype_kind`_char): Likewise.
+ (eoshift1_'atype_kind`_char4): Likewise.
+ * m4/eoshift3.m4 (eoshift3): Remove size argument, calculate
+ within function. Use array access macros for accessing array
+ descriptors.
+ (eoshift3_'atype_kind`): Remove size argument from call
+ to eoshift1.
+ (eoshift3_'atype_kind`_char): Likewise.
+ (eoshift3_'atype_kind`_char4): Likewise.
+ * m4/shape.m4 (shape_'rtype_kind`): Use array access macros
+ for accessing array descriptors.
+ * m4/cshift1.m4 (cshift1): Remove size argument, calculate
+ within function. Use array access macros for accessing array
+ descriptors.
+ (cshift1_'atype_kind`): Remove size argument from call to
+ cshift1.
+ (cshift1_'atype_kind`_char): Remove size argument from call to
+ cshift1.
+ (cshift1_'atype_kind`_char4): Remove size argument from call to
+ cshift1.
+ * m4/reshape.m4 (reshape_'rtype_ccode`): Use array access macros
+ for accessing array descriptors.
+ * m4/ifunction.m4 (name`'rtype_qual`_'atype_code): Likewise.
+ * intrinsics/pack_generic.c (pack_internal): Use array access
+ macros for accessing array descriptors.
+ (pack_s_internal): Likewise.
+ * intrinsics/transpose_generic.c (transpose_internal): Remove
+ size argument, calculate from array descriptor. Use array
+ access macros for accessing array descriptors.
+ (transpose): Remove size argument from call.
+ (transpoe_char): Likewise.
+ (transpose_char4): Likewise.
+ * intrinsics/move_alloc.c (move_alloc): Use array access macros
+ for accessing array descriptors.
+ * intrinsics/spread_generic.c (spread_internal): Remove size
+ argument, calculate from array descriptor. Use array access
+ macros for accessing array descriptors.
+ (spread_internal_scalar): Likewise.
+ (spread): Remove size argument from call to spread_internal.
+ (spread_char): Mark argument source_length as unused.
+ Remove size argument from call to spread_internal.
+ (spread_char4): Likewise.
+ (spread_char_scalar): Likewise.
+ (spread_char4_scalar): Likewise.
+ * intrinsics/unpack_generic.c (unpack_internal): Use array access
+ macros for accessing array descriptors.
+ * intrinsics/eoshift2.c (eoshift2): Remove size argument, calculate
+ from array descriptor instead. Use array access macros for
+ accessing array descriptors.
+ (eoshift2_##N): Remove size argument from call to eoshift2.
+ (eoshift2_##N_##char): Likewise.
+ (eoshift2_##N_##char4): Likewise.
+ * intrinsics/reshape_generic.c (reshape_internal): Use array
+ access macross for accessing array descriptors.
+ * libgfortran.h: Introduce new macros GFC_DIMENSION_LBOUND,
+ GFC_DIMENSION_UBOUND,GFC_DIMENSION_STRIDE, GFC_DIMENSION_EXTENT,
+ GFC_DIMENSION_SET, GFC_DESCRIPTOR_LBOUND, GFC_DESCRIPTOR_UBOUND,
+ GFC_DESCRIPTOR_EXTENT, GFC_DESCRIPTOR_EXTENT_BYTES,
+ GFC_DESCRIPTOR_STRIDE, GFC_DESCRIPTOR_STRIDE_BYTES
+ * runtime/in_pack_generic.c (internal_pack): Use new macros
+ for array descriptor access.
+ * runtime/in_unpack_generic.c (internal_unpack): Likewise.
+ * intrinsics/dtime.c (dtime_sub): Likewise.
+ * intrinsics/cshift0 (cshift0): Remove argument size,
+ calculate directly from the array descriptor. Use new macros
+ for array descriptor access.
+ * cshift0_##N: Remove shift argument in call to cshift0.
+ * cshift0_##N_char: Mark array_length as unused. Remove
+ array_length in call to cshift0.
+ * cshift0_##N_char4: Likewise.
+ * intrisics/etime.c: Use new macros for array descriptor access.
+ * intrinsics/stat.c (stat_i4_sub_0): Likewise.
+ (stat_i8_sub_0): Likewise.
+ (fstat_i4_sub): Likewise.
+ (fstat_i8_sub): Likewise.
+ * intrinsics/date_and_time.c (date_and_time): Likewise.
+ (secnds): Likewise.
+ (itime_i4): Likewise.
+ (itime_i8): Likewise.
+ (idate_i4): Likewise.
+ (idate_i8): Likewise.
+ (gmtime_i4): Likewise.
+ (gmtime_i8): Likewise.
+ (ltime_i4): Likewise.
+ (litme_i8): Likewise.
+ * intrinsics/associated.c (associated): Likewise.
+ * intrinsics/eoshift0.c (eoshift0): Likewise.
+ * intriniscs/size.c (size0): Likewise.
+ * intrinsics/random.c (arandom_r4): Likewise.
+ (arandom_r8): Likewise.
+ (arandom_r10): Likewise.
+ (arandom_r16): Likewise.
+ (random_seed_i4): Likewise.
+ (random_seed_i8): Likewise.
+ * io/list_read.c (nml_parse_qualifier): Likewise.
+ (nml_touch_nodes): Likewise.
+ (nml_read_obj): Likewise.
+ (get_name): Likewise.
+ * io/transfer.c (transfer_array): Likewise.
+ (init_loop_spec): Likewise.
+ (st_set_nml_var_dim): Likewise.
+ * io/write.c (nml_write_obj): Likewise.
+ (obj_loop): Likewise.
+ * generated/all_l1.c: Regenerated.
+ * generated/all_l16.c: Regenerated.
+ * generated/all_l2.c: Regenerated.
+ * generated/all_l4.c: Regenerated.
+ * generated/all_l8.c: Regenerated.
+ * generated/any_l1.c: Regenerated.
+ * generated/any_l16.c: Regenerated.
+ * generated/any_l2.c: Regenerated.
+ * generated/any_l4.c: Regenerated.
+ * generated/any_l8.c: Regenerated.
+ * generated/count_16_l.c: Regenerated.
+ * generated/count_1_l.c: Regenerated.
+ * generated/count_2_l.c: Regenerated.
+ * generated/count_4_l.c: Regenerated.
+ * generated/count_8_l.c: Regenerated.
+ * generated/cshift0_c10.c: Regenerated.
+ * generated/cshift0_c16.c: Regenerated.
+ * generated/cshift0_c4.c: Regenerated.
+ * generated/cshift0_c8.c: Regenerated.
+ * generated/cshift0_i1.c: Regenerated.
+ * generated/cshift0_i16.c: Regenerated.
+ * generated/cshift0_i2.c: Regenerated.
+ * generated/cshift0_i4.c: Regenerated.
+ * generated/cshift0_i8.c: Regenerated.
+ * generated/cshift0_r10.c: Regenerated.
+ * generated/cshift0_r16.c: Regenerated.
+ * generated/cshift0_r4.c: Regenerated.
+ * generated/cshift0_r8.c: Regenerated.
+ * generated/cshift1_16.c: Regenerated.
+ * generated/cshift1_4.c: Regenerated.
+ * generated/cshift1_8.c: Regenerated.
+ * generated/eoshift1_16.c: Regenerated.
+ * generated/eoshift1_4.c: Regenerated.
+ * generated/eoshift1_8.c: Regenerated.
+ * generated/eoshift3_16.c: Regenerated.
+ * generated/eoshift3_4.c: Regenerated.
+ * generated/eoshift3_8.c: Regenerated.
+ * generated/in_pack_c10.c: Regenerated.
+ * generated/in_pack_c16.c: Regenerated.
+ * generated/in_pack_c4.c: Regenerated.
+ * generated/in_pack_c8.c: Regenerated.
+ * generated/in_pack_i1.c: Regenerated.
+ * generated/in_pack_i16.c: Regenerated.
+ * generated/in_pack_i2.c: Regenerated.
+ * generated/in_pack_i4.c: Regenerated.
+ * generated/in_pack_i8.c: Regenerated.
+ * generated/in_pack_r10.c: Regenerated.
+ * generated/in_pack_r16.c: Regenerated.
+ * generated/in_pack_r4.c: Regenerated.
+ * generated/in_pack_r8.c: Regenerated.
+ * generated/in_unpack_c10.c: Regenerated.
+ * generated/in_unpack_c16.c: Regenerated.
+ * generated/in_unpack_c4.c: Regenerated.
+ * generated/in_unpack_c8.c: Regenerated.
+ * generated/in_unpack_i1.c: Regenerated.
+ * generated/in_unpack_i16.c: Regenerated.
+ * generated/in_unpack_i2.c: Regenerated.
+ * generated/in_unpack_i4.c: Regenerated.
+ * generated/in_unpack_i8.c: Regenerated.
+ * generated/in_unpack_r10.c: Regenerated.
+ * generated/in_unpack_r16.c: Regenerated.
+ * generated/in_unpack_r4.c: Regenerated.
+ * generated/in_unpack_r8.c: Regenerated.
+ * generated/matmul_c10.c: Regenerated.
+ * generated/matmul_c16.c: Regenerated.
+ * generated/matmul_c4.c: Regenerated.
+ * generated/matmul_c8.c: Regenerated.
+ * generated/matmul_i1.c: Regenerated.
+ * generated/matmul_i16.c: Regenerated.
+ * generated/matmul_i2.c: Regenerated.
+ * generated/matmul_i4.c: Regenerated.
+ * generated/matmul_i8.c: Regenerated.
+ * generated/matmul_l16.c: Regenerated.
+ * generated/matmul_l4.c: Regenerated.
+ * generated/matmul_l8.c: Regenerated.
+ * generated/matmul_r10.c: Regenerated.
+ * generated/matmul_r16.c: Regenerated.
+ * generated/matmul_r4.c: Regenerated.
+ * generated/matmul_r8.c: Regenerated.
+ * generated/maxloc0_16_i1.c: Regenerated.
+ * generated/maxloc0_16_i16.c: Regenerated.
+ * generated/maxloc0_16_i2.c: Regenerated.
+ * generated/maxloc0_16_i4.c: Regenerated.
+ * generated/maxloc0_16_i8.c: Regenerated.
+ * generated/maxloc0_16_r10.c: Regenerated.
+ * generated/maxloc0_16_r16.c: Regenerated.
+ * generated/maxloc0_16_r4.c: Regenerated.
+ * generated/maxloc0_16_r8.c: Regenerated.
+ * generated/maxloc0_4_i1.c: Regenerated.
+ * generated/maxloc0_4_i16.c: Regenerated.
+ * generated/maxloc0_4_i2.c: Regenerated.
+ * generated/maxloc0_4_i4.c: Regenerated.
+ * generated/maxloc0_4_i8.c: Regenerated.
+ * generated/maxloc0_4_r10.c: Regenerated.
+ * generated/maxloc0_4_r16.c: Regenerated.
+ * generated/maxloc0_4_r4.c: Regenerated.
+ * generated/maxloc0_4_r8.c: Regenerated.
+ * generated/maxloc0_8_i1.c: Regenerated.
+ * generated/maxloc0_8_i16.c: Regenerated.
+ * generated/maxloc0_8_i2.c: Regenerated.
+ * generated/maxloc0_8_i4.c: Regenerated.
+ * generated/maxloc0_8_i8.c: Regenerated.
+ * generated/maxloc0_8_r10.c: Regenerated.
+ * generated/maxloc0_8_r16.c: Regenerated.
+ * generated/maxloc0_8_r4.c: Regenerated.
+ * generated/maxloc0_8_r8.c: Regenerated.
+ * generated/maxloc1_16_i1.c: Regenerated.
+ * generated/maxloc1_16_i16.c: Regenerated.
+ * generated/maxloc1_16_i2.c: Regenerated.
+ * generated/maxloc1_16_i4.c: Regenerated.
+ * generated/maxloc1_16_i8.c: Regenerated.
+ * generated/maxloc1_16_r10.c: Regenerated.
+ * generated/maxloc1_16_r16.c: Regenerated.
+ * generated/maxloc1_16_r4.c: Regenerated.
+ * generated/maxloc1_16_r8.c: Regenerated.
+ * generated/maxloc1_4_i1.c: Regenerated.
+ * generated/maxloc1_4_i16.c: Regenerated.
+ * generated/maxloc1_4_i2.c: Regenerated.
+ * generated/maxloc1_4_i4.c: Regenerated.
+ * generated/maxloc1_4_i8.c: Regenerated.
+ * generated/maxloc1_4_r10.c: Regenerated.
+ * generated/maxloc1_4_r16.c: Regenerated.
+ * generated/maxloc1_4_r4.c: Regenerated.
+ * generated/maxloc1_4_r8.c: Regenerated.
+ * generated/maxloc1_8_i1.c: Regenerated.
+ * generated/maxloc1_8_i16.c: Regenerated.
+ * generated/maxloc1_8_i2.c: Regenerated.
+ * generated/maxloc1_8_i4.c: Regenerated.
+ * generated/maxloc1_8_i8.c: Regenerated.
+ * generated/maxloc1_8_r10.c: Regenerated.
+ * generated/maxloc1_8_r16.c: Regenerated.
+ * generated/maxloc1_8_r4.c: Regenerated.
+ * generated/maxloc1_8_r8.c: Regenerated.
+ * generated/maxval_i1.c: Regenerated.
+ * generated/maxval_i16.c: Regenerated.
+ * generated/maxval_i2.c: Regenerated.
+ * generated/maxval_i4.c: Regenerated.
+ * generated/maxval_i8.c: Regenerated.
+ * generated/maxval_r10.c: Regenerated.
+ * generated/maxval_r16.c: Regenerated.
+ * generated/maxval_r4.c: Regenerated.
+ * generated/maxval_r8.c: Regenerated.
+ * generated/minloc0_16_i1.c: Regenerated.
+ * generated/minloc0_16_i16.c: Regenerated.
+ * generated/minloc0_16_i2.c: Regenerated.
+ * generated/minloc0_16_i4.c: Regenerated.
+ * generated/minloc0_16_i8.c: Regenerated.
+ * generated/minloc0_16_r10.c: Regenerated.
+ * generated/minloc0_16_r16.c: Regenerated.
+ * generated/minloc0_16_r4.c: Regenerated.
+ * generated/minloc0_16_r8.c: Regenerated.
+ * generated/minloc0_4_i1.c: Regenerated.
+ * generated/minloc0_4_i16.c: Regenerated.
+ * generated/minloc0_4_i2.c: Regenerated.
+ * generated/minloc0_4_i4.c: Regenerated.
+ * generated/minloc0_4_i8.c: Regenerated.
+ * generated/minloc0_4_r10.c: Regenerated.
+ * generated/minloc0_4_r16.c: Regenerated.
+ * generated/minloc0_4_r4.c: Regenerated.
+ * generated/minloc0_4_r8.c: Regenerated.
+ * generated/minloc0_8_i1.c: Regenerated.
+ * generated/minloc0_8_i16.c: Regenerated.
+ * generated/minloc0_8_i2.c: Regenerated.
+ * generated/minloc0_8_i4.c: Regenerated.
+ * generated/minloc0_8_i8.c: Regenerated.
+ * generated/minloc0_8_r10.c: Regenerated.
+ * generated/minloc0_8_r16.c: Regenerated.
+ * generated/minloc0_8_r4.c: Regenerated.
+ * generated/minloc0_8_r8.c: Regenerated.
+ * generated/minloc1_16_i1.c: Regenerated.
+ * generated/minloc1_16_i16.c: Regenerated.
+ * generated/minloc1_16_i2.c: Regenerated.
+ * generated/minloc1_16_i4.c: Regenerated.
+ * generated/minloc1_16_i8.c: Regenerated.
+ * generated/minloc1_16_r10.c: Regenerated.
+ * generated/minloc1_16_r16.c: Regenerated.
+ * generated/minloc1_16_r4.c: Regenerated.
+ * generated/minloc1_16_r8.c: Regenerated.
+ * generated/minloc1_4_i1.c: Regenerated.
+ * generated/minloc1_4_i16.c: Regenerated.
+ * generated/minloc1_4_i2.c: Regenerated.
+ * generated/minloc1_4_i4.c: Regenerated.
+ * generated/minloc1_4_i8.c: Regenerated.
+ * generated/minloc1_4_r10.c: Regenerated.
+ * generated/minloc1_4_r16.c: Regenerated.
+ * generated/minloc1_4_r4.c: Regenerated.
+ * generated/minloc1_4_r8.c: Regenerated.
+ * generated/minloc1_8_i1.c: Regenerated.
+ * generated/minloc1_8_i16.c: Regenerated.
+ * generated/minloc1_8_i2.c: Regenerated.
+ * generated/minloc1_8_i4.c: Regenerated.
+ * generated/minloc1_8_i8.c: Regenerated.
+ * generated/minloc1_8_r10.c: Regenerated.
+ * generated/minloc1_8_r16.c: Regenerated.
+ * generated/minloc1_8_r4.c: Regenerated.
+ * generated/minloc1_8_r8.c: Regenerated.
+ * generated/minval_i1.c: Regenerated.
+ * generated/minval_i16.c: Regenerated.
+ * generated/minval_i2.c: Regenerated.
+ * generated/minval_i4.c: Regenerated.
+ * generated/minval_i8.c: Regenerated.
+ * generated/minval_r10.c: Regenerated.
+ * generated/minval_r16.c: Regenerated.
+ * generated/minval_r4.c: Regenerated.
+ * generated/minval_r8.c: Regenerated.
+ * generated/pack_c10.c: Regenerated.
+ * generated/pack_c16.c: Regenerated.
+ * generated/pack_c4.c: Regenerated.
+ * generated/pack_c8.c: Regenerated.
+ * generated/pack_i1.c: Regenerated.
+ * generated/pack_i16.c: Regenerated.
+ * generated/pack_i2.c: Regenerated.
+ * generated/pack_i4.c: Regenerated.
+ * generated/pack_i8.c: Regenerated.
+ * generated/pack_r10.c: Regenerated.
+ * generated/pack_r16.c: Regenerated.
+ * generated/pack_r4.c: Regenerated.
+ * generated/pack_r8.c: Regenerated.
+ * generated/product_c10.c: Regenerated.
+ * generated/product_c16.c: Regenerated.
+ * generated/product_c4.c: Regenerated.
+ * generated/product_c8.c: Regenerated.
+ * generated/product_i1.c: Regenerated.
+ * generated/product_i16.c: Regenerated.
+ * generated/product_i2.c: Regenerated.
+ * generated/product_i4.c: Regenerated.
+ * generated/product_i8.c: Regenerated.
+ * generated/product_r10.c: Regenerated.
+ * generated/product_r16.c: Regenerated.
+ * generated/product_r4.c: Regenerated.
+ * generated/product_r8.c: Regenerated.
+ * generated/reshape_c10.c: Regenerated.
+ * generated/reshape_c16.c: Regenerated.
+ * generated/reshape_c4.c: Regenerated.
+ * generated/reshape_c8.c: Regenerated.
+ * generated/reshape_i16.c: Regenerated.
+ * generated/reshape_i4.c: Regenerated.
+ * generated/reshape_i8.c: Regenerated.
+ * generated/reshape_r10.c: Regenerated.
+ * generated/reshape_r16.c: Regenerated.
+ * generated/reshape_r4.c: Regenerated.
+ * generated/reshape_r8.c: Regenerated.
+ * generated/shape_i16.c: Regenerated.
+ * generated/shape_i4.c: Regenerated.
+ * generated/shape_i8.c: Regenerated.
+ * generated/spread_c10.c: Regenerated.
+ * generated/spread_c16.c: Regenerated.
+ * generated/spread_c4.c: Regenerated.
+ * generated/spread_c8.c: Regenerated.
+ * generated/spread_i1.c: Regenerated.
+ * generated/spread_i16.c: Regenerated.
+ * generated/spread_i2.c: Regenerated.
+ * generated/spread_i4.c: Regenerated.
+ * generated/spread_i8.c: Regenerated.
+ * generated/spread_r10.c: Regenerated.
+ * generated/spread_r16.c: Regenerated.
+ * generated/spread_r4.c: Regenerated.
+ * generated/spread_r8.c: Regenerated.
+ * generated/sum_c10.c: Regenerated.
+ * generated/sum_c16.c: Regenerated.
+ * generated/sum_c4.c: Regenerated.
+ * generated/sum_c8.c: Regenerated.
+ * generated/sum_i1.c: Regenerated.
+ * generated/sum_i16.c: Regenerated.
+ * generated/sum_i2.c: Regenerated.
+ * generated/sum_i4.c: Regenerated.
+ * generated/sum_i8.c: Regenerated.
+ * generated/sum_r10.c: Regenerated.
+ * generated/sum_r16.c: Regenerated.
+ * generated/sum_r4.c: Regenerated.
+ * generated/sum_r8.c: Regenerated.
+ * generated/transpose_c10.c: Regenerated.
+ * generated/transpose_c16.c: Regenerated.
+ * generated/transpose_c4.c: Regenerated.
+ * generated/transpose_c8.c: Regenerated.
+ * generated/transpose_i16.c: Regenerated.
+ * generated/transpose_i4.c: Regenerated.
+ * generated/transpose_i8.c: Regenerated.
+ * generated/transpose_r10.c: Regenerated.
+ * generated/transpose_r16.c: Regenerated.
+ * generated/transpose_r4.c: Regenerated.
+ * generated/transpose_r8.c: Regenerated.
+ * generated/unpack_c10.c: Regenerated.
+ * generated/unpack_c16.c: Regenerated.
+ * generated/unpack_c4.c: Regenerated.
+ * generated/unpack_c8.c: Regenerated.
+ * generated/unpack_i1.c: Regenerated.
+ * generated/unpack_i16.c: Regenerated.
+ * generated/unpack_i2.c: Regenerated.
+ * generated/unpack_i4.c: Regenerated.
+ * generated/unpack_i8.c: Regenerated.
+ * generated/unpack_r10.c: Regenerated.
+ * generated/unpack_r16.c: Regenerated.
+ * generated/unpack_r4.c: Regenerated.
+ * generated/unpack_r8.c: Regenerated.
+
2009-06-14 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* fmain.c (main): Don't PREFIX set_args.
diff --git a/libgfortran/generated/all_l1.c b/libgfortran/generated/all_l1.c
index 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];
diff --git a/libgfortran/intrinsics/associated.c b/libgfortran/intrinsics/associated.c
index 87b449edb4d..0aade1d95b7 100644
--- a/libgfortran/intrinsics/associated.c
+++ b/libgfortran/intrinsics/associated.c
@@ -43,14 +43,14 @@ associated (const gfc_array_void *pointer, const gfc_array_void *target)
rank = GFC_DESCRIPTOR_RANK (pointer);
for (n = 0; n < rank; n++)
{
- long diff;
- diff = pointer->dim[n].ubound - pointer->dim[n].lbound;
+ long extent;
+ extent = GFC_DESCRIPTOR_EXTENT(pointer,n);
- if (diff != (target->dim[n].ubound - target->dim[n].lbound))
+ if (extent != GFC_DESCRIPTOR_EXTENT(target,n))
return 0;
- if (pointer->dim[n].stride != target->dim[n].stride && diff != 0)
+ if (GFC_DESCRIPTOR_STRIDE(pointer,n) != GFC_DESCRIPTOR_STRIDE(target,n) && extent != 1)
return 0;
- if (pointer->dim[n].ubound < pointer->dim[n].lbound)
+ if (extent <= 0)
return 0;
}
diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c
index be0444a4807..1b7dbc1cec9 100644
--- a/libgfortran/intrinsics/cshift0.c
+++ b/libgfortran/intrinsics/cshift0.c
@@ -1,5 +1,5 @@
/* Generic implementation of the CSHIFT intrinsic
- Copyright 2003, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
Contributed by Feng Wang <wf_cs@yahoo.com>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -7,21 +7,26 @@ This file is part of the GNU Fortran 95 runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
-version 3 of the License, or (at your option) any later version.
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
Libgfortran is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING. If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
#include "libgfortran.h"
#include <stdlib.h>
@@ -30,7 +35,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
static void
cshift0 (gfc_array_char * ret, const gfc_array_char * array,
- index_type shift, int which, index_type size)
+ ssize_t shift, int which, index_type size)
{
/* r.* indicates the return array. */
index_type rstride[GFC_MAX_DIMENSIONS];
@@ -66,14 +71,17 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
{
- ret->dim[i].lbound = 0;
- ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
+ index_type ub, str;
+
+ ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1;
if (i == 0)
- ret->dim[i].stride = 1;
+ str = 1;
else
- ret->dim[i].stride = (ret->dim[i-1].ubound + 1)
- * ret->dim[i-1].stride;
+ str = GFC_DESCRIPTOR_EXTENT(ret,i-1) *
+ GFC_DESCRIPTOR_STRIDE(ret,i-1);
+
+ GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
}
if (arraysize > 0)
@@ -278,20 +286,20 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
{
if (dim == which)
{
- roffset = ret->dim[dim].stride * size;
+ roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
if (roffset == 0)
roffset = size;
- soffset = array->dim[dim].stride * size;
+ soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
if (soffset == 0)
soffset = size;
- len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(array,dim);
}
else
{
count[n] = 0;
- extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
- rstride[n] = ret->dim[dim].stride * size;
- sstride[n] = array->dim[dim].stride * size;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim);
+ rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
+ sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
n++;
}
}
@@ -306,7 +314,7 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
rptr = ret->data;
sptr = array->data;
- shift = len == 0 ? 0 : shift % len;
+ shift = len == 0 ? 0 : shift % (ssize_t)len;
if (shift < 0)
shift += len;
diff --git a/libgfortran/intrinsics/date_and_time.c b/libgfortran/intrinsics/date_and_time.c
index be64626637c..4bc6e6928c0 100644
--- a/libgfortran/intrinsics/date_and_time.c
+++ b/libgfortran/intrinsics/date_and_time.c
@@ -265,8 +265,8 @@ date_and_time (char *__date, char *__time, char *__zone,
index_type len, delta, elt_size;
elt_size = GFC_DESCRIPTOR_SIZE (__values);
- len = __values->dim[0].ubound + 1 - __values->dim[0].lbound;
- delta = __values->dim[0].stride;
+ len = GFC_DESCRIPTOR_EXTENT(__values,0);
+ delta = GFC_DESCRIPTOR_STRIDE(__values,0);
if (delta == 0)
delta = 1;
@@ -351,9 +351,7 @@ secnds (GFC_REAL_4 *x)
& GFC_DTYPE_TYPE_MASK) +
(4 << GFC_DTYPE_SIZE_SHIFT);
- avalues->dim[0].ubound = 7;
- avalues->dim[0].lbound = 0;
- avalues->dim[0].stride = 1;
+ GFC_DIMENSION_SET(avalues->dim[0], 0, 7, 1);
date_and_time (NULL, NULL, NULL, avalues, 0, 0, 0);
@@ -411,9 +409,9 @@ itime_i4 (gfc_array_i4 *__values)
itime0(x);
/* Copy the value into the array. */
- len = __values->dim[0].ubound + 1 - __values->dim[0].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(__values,0);
assert (len >= 3);
- delta = __values->dim[0].stride;
+ delta = GFC_DESCRIPTOR_STRIDE(__values,0);
if (delta == 0)
delta = 1;
@@ -437,9 +435,9 @@ itime_i8 (gfc_array_i8 *__values)
itime0(x);
/* Copy the value into the array. */
- len = __values->dim[0].ubound + 1 - __values->dim[0].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(__values,0);
assert (len >= 3);
- delta = __values->dim[0].stride;
+ delta = GFC_DESCRIPTOR_STRIDE(__values,0);
if (delta == 0)
delta = 1;
@@ -493,9 +491,9 @@ idate_i4 (gfc_array_i4 *__values)
idate0(x);
/* Copy the value into the array. */
- len = __values->dim[0].ubound + 1 - __values->dim[0].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(__values,0);
assert (len >= 3);
- delta = __values->dim[0].stride;
+ delta = GFC_DESCRIPTOR_STRIDE(__values,0);
if (delta == 0)
delta = 1;
@@ -519,9 +517,9 @@ idate_i8 (gfc_array_i8 *__values)
idate0(x);
/* Copy the value into the array. */
- len = __values->dim[0].ubound + 1 - __values->dim[0].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(__values,0);
assert (len >= 3);
- delta = __values->dim[0].stride;
+ delta = GFC_DESCRIPTOR_STRIDE(__values,0);
if (delta == 0)
delta = 1;
@@ -583,9 +581,9 @@ gmtime_i4 (GFC_INTEGER_4 * t, gfc_array_i4 * tarray)
gmtime_0(&tt, x);
/* Copy the values into the array. */
- len = tarray->dim[0].ubound + 1 - tarray->dim[0].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(tarray,0);
assert (len >= 9);
- delta = tarray->dim[0].stride;
+ delta = GFC_DESCRIPTOR_STRIDE(tarray,0);
if (delta == 0)
delta = 1;
@@ -610,9 +608,9 @@ gmtime_i8 (GFC_INTEGER_8 * t, gfc_array_i8 * tarray)
gmtime_0(&tt, x);
/* Copy the values into the array. */
- len = tarray->dim[0].ubound + 1 - tarray->dim[0].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(tarray,0);
assert (len >= 9);
- delta = tarray->dim[0].stride;
+ delta = GFC_DESCRIPTOR_STRIDE(tarray,0);
if (delta == 0)
delta = 1;
@@ -675,9 +673,9 @@ ltime_i4 (GFC_INTEGER_4 * t, gfc_array_i4 * tarray)
ltime_0(&tt, x);
/* Copy the values into the array. */
- len = tarray->dim[0].ubound + 1 - tarray->dim[0].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(tarray,0);
assert (len >= 9);
- delta = tarray->dim[0].stride;
+ delta = GFC_DESCRIPTOR_STRIDE(tarray,0);
if (delta == 0)
delta = 1;
@@ -702,9 +700,9 @@ ltime_i8 (GFC_INTEGER_8 * t, gfc_array_i8 * tarray)
ltime_0(&tt, x);
/* Copy the values into the array. */
- len = tarray->dim[0].ubound + 1 - tarray->dim[0].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(tarray,0);
assert (len >= 9);
- delta = tarray->dim[0].stride;
+ delta = GFC_DESCRIPTOR_STRIDE(tarray,0);
if (delta == 0)
delta = 1;
diff --git a/libgfortran/intrinsics/dtime.c b/libgfortran/intrinsics/dtime.c
index 40028a689c2..4b7000b4466 100644
--- a/libgfortran/intrinsics/dtime.c
+++ b/libgfortran/intrinsics/dtime.c
@@ -42,7 +42,7 @@ dtime_sub (gfc_array_r4 *t, GFC_REAL_4 *result)
GFC_REAL_4 *tp;
long user_sec, user_usec, system_sec, system_usec;
- if (((t->dim[0].ubound + 1 - t->dim[0].lbound)) < 2)
+ if (((GFC_DESCRIPTOR_EXTENT(t,0))) < 2)
runtime_error ("Insufficient number of elements in TARRAY.");
__gthread_mutex_lock (&dtime_update_lock);
@@ -62,7 +62,7 @@ dtime_sub (gfc_array_r4 *t, GFC_REAL_4 *result)
tp = t->data;
*tp = tu;
- tp += t->dim[0].stride;
+ tp += GFC_DESCRIPTOR_STRIDE(t,0);
*tp = ts;
*result = tt;
__gthread_mutex_unlock (&dtime_update_lock);
diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c
index 6ac7c94a75b..4b8082fdeca 100644
--- a/libgfortran/intrinsics/eoshift0.c
+++ b/libgfortran/intrinsics/eoshift0.c
@@ -70,13 +70,18 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
{
- ret->dim[i].lbound = 0;
- ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
+ index_type ub, str;
+
+ ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1;
if (i == 0)
- ret->dim[i].stride = 1;
+ str = 1;
else
- ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
+ str = GFC_DESCRIPTOR_EXTENT(ret,i-1)
+ * GFC_DESCRIPTOR_STRIDE(ret,i-1);
+
+ GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
+
}
}
else
@@ -96,20 +101,20 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
{
if (dim == which)
{
- roffset = ret->dim[dim].stride * size;
+ roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
if (roffset == 0)
roffset = size;
- soffset = array->dim[dim].stride * size;
+ soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
if (soffset == 0)
soffset = size;
- len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(array,dim);
}
else
{
count[n] = 0;
- extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
- rstride[n] = ret->dim[dim].stride * size;
- sstride[n] = array->dim[dim].stride * size;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim);
+ rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
+ sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
n++;
}
}
diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c
index 763545a6389..aa5ef5ad90f 100644
--- a/libgfortran/intrinsics/eoshift2.c
+++ b/libgfortran/intrinsics/eoshift2.c
@@ -34,7 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
static void
eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
int shift, const gfc_array_char *bound, int which,
- index_type size, const char *filler, index_type filler_len)
+ const char *filler, index_type filler_len)
{
/* r.* indicates the return array. */
index_type rstride[GFC_MAX_DIMENSIONS];
@@ -59,6 +59,7 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
index_type len;
index_type n;
index_type arraysize;
+ index_type size;
/* The compiler cannot figure out that these are set, initialize
them to avoid warnings. */
@@ -66,6 +67,8 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
soffset = 0;
roffset = 0;
+ size = GFC_DESCRIPTOR_SIZE (array);
+
arraysize = size0 ((array_t *) array);
if (ret->data == NULL)
@@ -77,13 +80,18 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
{
- ret->dim[i].lbound = 0;
- ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
+ index_type ub, str;
+
+ ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1;
if (i == 0)
- ret->dim[i].stride = 1;
+ str = 1;
else
- ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
+ str = GFC_DESCRIPTOR_EXTENT(ret,i-1)
+ * GFC_DESCRIPTOR_STRIDE(ret,i-1);
+
+ GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
+
}
}
else
@@ -107,22 +115,22 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
{
if (dim == which)
{
- roffset = ret->dim[dim].stride * size;
+ roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
if (roffset == 0)
roffset = size;
- soffset = array->dim[dim].stride * size;
+ soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
if (soffset == 0)
soffset = size;
- len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(array,dim);
}
else
{
count[n] = 0;
- extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
- rstride[n] = ret->dim[dim].stride * size;
- sstride[n] = array->dim[dim].stride * size;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim);
+ rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
+ sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
if (bound)
- bstride[n] = bound->dim[n].stride * size;
+ bstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(bound,n);
else
bstride[n] = 0;
n++;
@@ -256,7 +264,7 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
const GFC_INTEGER_##N *pdim) \
{ \
eoshift2 (ret, array, *pshift, pbound, pdim ? *pdim : 1, \
- GFC_DESCRIPTOR_SIZE (array), "\0", 1); \
+ "\0", 1); \
} \
\
extern void eoshift2_##N##_char (gfc_array_char *, GFC_INTEGER_4, \
@@ -274,11 +282,11 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
const GFC_INTEGER_##N *pshift, \
const gfc_array_char *pbound, \
const GFC_INTEGER_##N *pdim, \
- GFC_INTEGER_4 array_length, \
+ GFC_INTEGER_4 array_length __attribute__((unused)), \
GFC_INTEGER_4 bound_length __attribute__((unused))) \
{ \
eoshift2 (ret, array, *pshift, pbound, pdim ? *pdim : 1, \
- array_length, " ", 1); \
+ " ", 1); \
} \
\
extern void eoshift2_##N##_char4 (gfc_array_char *, GFC_INTEGER_4, \
@@ -296,12 +304,12 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
const GFC_INTEGER_##N *pshift, \
const gfc_array_char *pbound, \
const GFC_INTEGER_##N *pdim, \
- GFC_INTEGER_4 array_length, \
+ GFC_INTEGER_4 array_length __attribute__((unused)), \
GFC_INTEGER_4 bound_length __attribute__((unused))) \
{ \
static const gfc_char4_t space = (unsigned char) ' '; \
eoshift2 (ret, array, *pshift, pbound, pdim ? *pdim : 1, \
- array_length * sizeof (gfc_char4_t), (const char *) &space, \
+ (const char *) &space, \
sizeof (gfc_char4_t)); \
}
diff --git a/libgfortran/intrinsics/etime.c b/libgfortran/intrinsics/etime.c
index 1ae357ed56e..b0fd742ea96 100644
--- a/libgfortran/intrinsics/etime.c
+++ b/libgfortran/intrinsics/etime.c
@@ -35,7 +35,7 @@ etime_sub (gfc_array_r4 *t, GFC_REAL_4 *result)
GFC_REAL_4 tu, ts, tt, *tp;
long user_sec, user_usec, system_sec, system_usec;
- if (((t->dim[0].ubound + 1 - t->dim[0].lbound)) < 2)
+ if (((GFC_DESCRIPTOR_EXTENT(t,0))) < 2)
runtime_error ("Insufficient number of elements in TARRAY.");
if (__time_1 (&user_sec, &user_usec, &system_sec, &system_usec) == 0)
@@ -54,7 +54,7 @@ etime_sub (gfc_array_r4 *t, GFC_REAL_4 *result)
tp = t->data;
*tp = tu;
- tp += t->dim[0].stride;
+ tp += GFC_DESCRIPTOR_STRIDE(t,0);
*tp = ts;
*result = tt;
}
diff --git a/libgfortran/intrinsics/iso_c_binding.c b/libgfortran/intrinsics/iso_c_binding.c
index 38f07753c72..bb25e3e2d4f 100644
--- a/libgfortran/intrinsics/iso_c_binding.c
+++ b/libgfortran/intrinsics/iso_c_binding.c
@@ -75,9 +75,8 @@ ISO_C_BINDING_PREFIX (c_f_pointer) (void *c_ptr_in,
/* A generic function to set the common fields of all descriptors, no
- matter whether it's to a scalar or an array. Fields set are: data,
- and if appropriate, rank, offset, dim[*].lbound, dim[*].ubound, and
- dim[*].stride. Parameter shape is a rank 1 array of integers
+ matter whether it's to a scalar or an array. Access is via the array
+ descrptor macros. Parameter shape is a rank 1 array of integers
containing the upper bound of each dimension of what f_ptr_out
points to. The length of this array must be EXACTLY the rank of
what f_ptr_out points to, as required by the draft (J3/04-007). If
@@ -104,51 +103,51 @@ ISO_C_BINDING_PREFIX (c_f_pointer_u0) (void *c_ptr_in,
p = shape->data;
size = GFC_DESCRIPTOR_SIZE(shape);
- source_stride = shape->dim[0].stride * size;
+ source_stride = GFC_DESCRIPTOR_STRIDE_BYTES(shape,0);
/* shape's length (rank of the output array) */
- shapeSize = shape->dim[0].ubound + 1 - shape->dim[0].lbound;
+ shapeSize = GFC_DESCRIPTOR_EXTENT(shape,0);
for (i = 0; i < shapeSize; i++)
{
- /* Lower bound is 1, as specified by the draft. */
- f_ptr_out->dim[i].lbound = 1;
+ index_type str, ub;
+
/* Have to allow for the SHAPE array to be any valid kind for
an INTEGER type. */
#ifdef HAVE_GFC_INTEGER_1
if (size == 1)
- f_ptr_out->dim[i].ubound = *((GFC_INTEGER_1 *) p);
+ ub = *((GFC_INTEGER_1 *) p);
#endif
#ifdef HAVE_GFC_INTEGER_2
if (size == 2)
- f_ptr_out->dim[i].ubound = *((GFC_INTEGER_2 *) p);
+ ub = *((GFC_INTEGER_2 *) p);
#endif
#ifdef HAVE_GFC_INTEGER_4
if (size == 4)
- f_ptr_out->dim[i].ubound = *((GFC_INTEGER_4 *) p);
+ ub = *((GFC_INTEGER_4 *) p);
#endif
#ifdef HAVE_GFC_INTEGER_8
if (size == 8)
- f_ptr_out->dim[i].ubound = *((GFC_INTEGER_8 *) p);
+ ub = *((GFC_INTEGER_8 *) p);
#endif
#ifdef HAVE_GFC_INTEGER_16
if (size == 16)
- f_ptr_out->dim[i].ubound = *((GFC_INTEGER_16 *) p);
+ ub = *((GFC_INTEGER_16 *) p);
#endif
p += source_stride;
if (i == 0)
{
- f_ptr_out->dim[0].stride = 1;
- f_ptr_out->offset = f_ptr_out->dim[0].lbound
- * f_ptr_out->dim[0].stride;
+ str = 1;
+ f_ptr_out->offset = str;
}
else
{
- f_ptr_out->dim[i].stride = (f_ptr_out->dim[i-1].ubound + 1)
- - f_ptr_out->dim[i-1].lbound;
- f_ptr_out->offset += f_ptr_out->dim[i].lbound
- * f_ptr_out->dim[i].stride;
+ str = GFC_DESCRIPTOR_EXTENT(f_ptr_out,i-1);
+ f_ptr_out->offset += str;
}
+
+ /* Lower bound is 1, as specified by the draft. */
+ GFC_DIMENSION_SET(f_ptr_out->dim[i], 1, ub, str);
}
f_ptr_out->offset *= -1;
diff --git a/libgfortran/intrinsics/move_alloc.c b/libgfortran/intrinsics/move_alloc.c
index 527aa6f250d..9b5497c9bc7 100644
--- a/libgfortran/intrinsics/move_alloc.c
+++ b/libgfortran/intrinsics/move_alloc.c
@@ -42,11 +42,11 @@ move_alloc (gfc_array_char * from, gfc_array_char * to)
for (i = 0; i < GFC_DESCRIPTOR_RANK (from); i++)
{
- to->dim[i].lbound = from->dim[i].lbound;
- to->dim[i].ubound = from->dim[i].ubound;
- to->dim[i].stride = from->dim[i].stride;
- from->dim[i].stride = 0;
- from->dim[i].ubound = from->dim[i].lbound;
+ GFC_DIMENSION_SET(to->dim[i],GFC_DESCRIPTOR_LBOUND(from,i),
+ GFC_DESCRIPTOR_UBOUND(from,i),
+ GFC_DESCRIPTOR_STRIDE(from,i));
+ GFC_DIMENSION_SET(from->dim[i],GFC_DESCRIPTOR_LBOUND(from,i),
+ GFC_DESCRIPTOR_LBOUND(from,i), 0);
}
to->offset = from->offset;
diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c
index 4c89dad31f8..b611d777101 100644
--- a/libgfortran/intrinsics/pack_generic.c
+++ b/libgfortran/intrinsics/pack_generic.c
@@ -121,11 +121,11 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
for (n = 0; n < dim; n++)
{
count[n] = 0;
- extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
zero_sized = 1;
- sstride[n] = array->dim[n].stride * size;
- mstride[n] = mask->dim[n].stride * mask_kind;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n);
+ mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
}
if (sstride[0] == 0)
sstride[0] = size;
@@ -141,7 +141,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
{
/* The return array will have as many
elements as there are in VECTOR. */
- total = vector->dim[0].ubound + 1 - vector->dim[0].lbound;
+ total = GFC_DESCRIPTOR_EXTENT(vector,0);
}
else
{
@@ -204,9 +204,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
if (ret->data == NULL)
{
/* Setup the array descriptor. */
- ret->dim[0].lbound = 0;
- ret->dim[0].ubound = total - 1;
- ret->dim[0].stride = 1;
+ GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
ret->offset = 0;
if (total == 0)
@@ -223,7 +221,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
/* We come here because of range checking. */
index_type ret_extent;
- ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0);
if (total != ret_extent)
runtime_error ("Incorrect extent in return value of PACK intrinsic;"
" is %ld, should be %ld", (long int) total,
@@ -231,7 +229,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
}
}
- rstride0 = ret->dim[0].stride * size;
+ rstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(ret,0);
if (rstride0 == 0)
rstride0 = size;
sstride0 = sstride[0];
@@ -280,11 +278,11 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
/* Add any remaining elements from VECTOR. */
if (vector)
{
- n = vector->dim[0].ubound + 1 - vector->dim[0].lbound;
+ n = GFC_DESCRIPTOR_EXTENT(vector,0);
nelem = ((rptr - ret->data) / rstride0);
if (n > nelem)
{
- sstride0 = vector->dim[0].stride * size;
+ sstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(vector,0);
if (sstride0 == 0)
sstride0 = size;
@@ -511,11 +509,11 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
for (n = 0; n < dim; n++)
{
count[n] = 0;
- extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] < 0)
extent[n] = 0;
- sstride[n] = array->dim[n].stride * size;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n);
ssize *= extent[n];
}
if (sstride[0] == 0)
@@ -536,7 +534,7 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
{
/* The return array will have as many elements as there are
in vector. */
- total = vector->dim[0].ubound + 1 - vector->dim[0].lbound;
+ total = GFC_DESCRIPTOR_EXTENT(vector,0);
if (total <= 0)
{
total = 0;
@@ -559,9 +557,8 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
}
/* Setup the array descriptor. */
- ret->dim[0].lbound = 0;
- ret->dim[0].ubound = total - 1;
- ret->dim[0].stride = 1;
+ GFC_DIMENSION_SET(ret->dim[0],0,total-1,1);
+
ret->offset = 0;
if (total == 0)
@@ -573,7 +570,7 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
ret->data = internal_malloc_size (size * total);
}
- rstride0 = ret->dim[0].stride * size;
+ rstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(ret,0);
if (rstride0 == 0)
rstride0 = size;
rptr = ret->data;
@@ -623,11 +620,11 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
/* Add any remaining elements from VECTOR. */
if (vector)
{
- n = vector->dim[0].ubound + 1 - vector->dim[0].lbound;
+ n = GFC_DESCRIPTOR_EXTENT(vector,0);
nelem = ((rptr - ret->data) / rstride0);
if (n > nelem)
{
- sstride0 = vector->dim[0].stride * size;
+ sstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(vector,0);
if (sstride0 == 0)
sstride0 = size;
diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c
index 0d1f25f7041..803049b065f 100644
--- a/libgfortran/intrinsics/random.c
+++ b/libgfortran/intrinsics/random.c
@@ -374,8 +374,8 @@ arandom_r4 (gfc_array_r4 *x)
for (n = 0; n < dim; n++)
{
count[n] = 0;
- stride[n] = x->dim[n].stride;
- extent[n] = x->dim[n].ubound + 1 - x->dim[n].lbound;
+ stride[n] = GFC_DESCRIPTOR_STRIDE(x,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(x,n);
if (extent[n] <= 0)
return;
}
@@ -441,8 +441,8 @@ arandom_r8 (gfc_array_r8 *x)
for (n = 0; n < dim; n++)
{
count[n] = 0;
- stride[n] = x->dim[n].stride;
- extent[n] = x->dim[n].ubound + 1 - x->dim[n].lbound;
+ stride[n] = GFC_DESCRIPTOR_STRIDE(x,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(x,n);
if (extent[n] <= 0)
return;
}
@@ -511,8 +511,8 @@ arandom_r10 (gfc_array_r10 *x)
for (n = 0; n < dim; n++)
{
count[n] = 0;
- stride[n] = x->dim[n].stride;
- extent[n] = x->dim[n].ubound + 1 - x->dim[n].lbound;
+ stride[n] = GFC_DESCRIPTOR_STRIDE(x,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(x,n);
if (extent[n] <= 0)
return;
}
@@ -583,8 +583,8 @@ arandom_r16 (gfc_array_r16 *x)
for (n = 0; n < dim; n++)
{
count[n] = 0;
- stride[n] = x->dim[n].stride;
- extent[n] = x->dim[n].ubound + 1 - x->dim[n].lbound;
+ stride[n] = GFC_DESCRIPTOR_STRIDE(x,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(x,n);
if (extent[n] <= 0)
return;
}
@@ -690,13 +690,13 @@ random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get)
runtime_error ("Array rank of PUT is not 1.");
/* If the array is too small, abort. */
- if (((put->dim[0].ubound + 1 - put->dim[0].lbound)) < kiss_size)
+ if (GFC_DESCRIPTOR_EXTENT(put,0) < kiss_size)
runtime_error ("Array size of PUT is too small.");
/* We copy the seed given by the user. */
for (i = 0; i < kiss_size; i++)
memcpy (seed + i * sizeof(GFC_UINTEGER_4),
- &(put->data[(kiss_size - 1 - i) * put->dim[0].stride]),
+ &(put->data[(kiss_size - 1 - i) * GFC_DESCRIPTOR_STRIDE(put,0)]),
sizeof(GFC_UINTEGER_4));
/* We put it after scrambling the bytes, to paper around users who
@@ -712,7 +712,7 @@ random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get)
runtime_error ("Array rank of GET is not 1.");
/* If the array is too small, abort. */
- if (((get->dim[0].ubound + 1 - get->dim[0].lbound)) < kiss_size)
+ if (GFC_DESCRIPTOR_EXTENT(get,0) < kiss_size)
runtime_error ("Array size of GET is too small.");
/* Unscramble the seed. */
@@ -720,7 +720,7 @@ random_seed_i4 (GFC_INTEGER_4 *size, gfc_array_i4 *put, gfc_array_i4 *get)
/* Then copy it back to the user variable. */
for (i = 0; i < kiss_size; i++)
- memcpy (&(get->data[(kiss_size - 1 - i) * get->dim[0].stride]),
+ memcpy (&(get->data[(kiss_size - 1 - i) * GFC_DESCRIPTOR_STRIDE(get,0)]),
seed + i * sizeof(GFC_UINTEGER_4),
sizeof(GFC_UINTEGER_4));
}
@@ -757,12 +757,12 @@ random_seed_i8 (GFC_INTEGER_8 *size, gfc_array_i8 *put, gfc_array_i8 *get)
runtime_error ("Array rank of PUT is not 1.");
/* If the array is too small, abort. */
- if (((put->dim[0].ubound + 1 - put->dim[0].lbound)) < kiss_size / 2)
+ if (GFC_DESCRIPTOR_EXTENT(put,0) < kiss_size / 2)
runtime_error ("Array size of PUT is too small.");
/* This code now should do correct strides. */
for (i = 0; i < kiss_size / 2; i++)
- memcpy (&kiss_seed[2*i], &(put->data[i * put->dim[0].stride]),
+ memcpy (&kiss_seed[2*i], &(put->data[i * GFC_DESCRIPTOR_STRIDE(put,0)]),
sizeof (GFC_UINTEGER_8));
}
@@ -774,12 +774,12 @@ random_seed_i8 (GFC_INTEGER_8 *size, gfc_array_i8 *put, gfc_array_i8 *get)
runtime_error ("Array rank of GET is not 1.");
/* If the array is too small, abort. */
- if (((get->dim[0].ubound + 1 - get->dim[0].lbound)) < kiss_size / 2)
+ if (GFC_DESCRIPTOR_EXTENT(get,0) < kiss_size / 2)
runtime_error ("Array size of GET is too small.");
/* This code now should do correct strides. */
for (i = 0; i < kiss_size / 2; i++)
- memcpy (&(get->data[i * get->dim[0].stride]), &kiss_seed[2*i],
+ memcpy (&(get->data[i * GFC_DESCRIPTOR_STRIDE(get,0)]), &kiss_seed[2*i],
sizeof (GFC_UINTEGER_8));
}
diff --git a/libgfortran/intrinsics/reshape_generic.c b/libgfortran/intrinsics/reshape_generic.c
index 0f3022701c4..bb1552aa433 100644
--- a/libgfortran/intrinsics/reshape_generic.c
+++ b/libgfortran/intrinsics/reshape_generic.c
@@ -67,7 +67,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
int sempty, pempty, shape_empty;
index_type shape_data[GFC_MAX_DIMENSIONS];
- rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1;
+ rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
@@ -75,7 +75,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
for (n = 0; n < rdim; n++)
{
- shape_data[n] = shape->data[n * shape->dim[0].stride];
+ shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)];
if (shape_data[n] <= 0)
{
shape_data[n] = 0;
@@ -85,14 +85,13 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
if (ret->data == NULL)
{
- rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1;
rs = 1;
for (n = 0; n < rdim; n++)
{
- ret->dim[n].lbound = 0;
rex = shape_data[n];
- ret->dim[n].ubound = rex - 1;
- ret->dim[n].stride = rs;
+
+ GFC_DIMENSION_SET(ret->dim[n],0,rex - 1,rs);
+
rs *= rex;
}
ret->offset = 0;
@@ -111,8 +110,8 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
for (n = 0; n < pdim; n++)
{
pcount[n] = 0;
- pstride[n] = pad->dim[n].stride;
- pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound;
+ pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n);
+ pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n);
if (pextent[n] <= 0)
{
pempty = 1;
@@ -142,7 +141,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
for (n = 0; n < rdim; n++)
{
rs *= shape_data[n];
- ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n);
if (ret_extent != shape_data[n])
runtime_error("Incorrect extent in return value of RESHAPE"
" intrinsic in dimension %ld: is %ld,"
@@ -155,7 +154,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
for (n = 0; n < sdim; n++)
{
index_type se;
- se = source->dim[n].ubound + 1 - source->dim[0].lbound;
+ se = GFC_DESCRIPTOR_EXTENT(source,n);
source_extent *= se > 0 ? se : 0;
}
@@ -174,7 +173,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
for (n = 0; n < rdim; n++)
{
- v = order->data[n * order->dim[0].stride] - 1;
+ v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1;
if (v < 0 || v >= rdim)
runtime_error("Value %ld out of range in ORDER argument"
@@ -193,13 +192,13 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
for (n = 0; n < rdim; n++)
{
if (order)
- dim = order->data[n * order->dim[0].stride] - 1;
+ dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1;
else
dim = n;
rcount[n] = 0;
- rstride[n] = ret->dim[dim].stride;
- rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound;
+ rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim);
+ rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim);
if (rextent[n] != shape_data[dim])
runtime_error ("shape and target do not conform");
@@ -218,8 +217,8 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
for (n = 0; n < sdim; n++)
{
scount[n] = 0;
- sstride[n] = source->dim[n].stride;
- sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n);
+ sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n);
if (sextent[n] <= 0)
{
sempty = 1;
diff --git a/libgfortran/intrinsics/size.c b/libgfortran/intrinsics/size.c
index 9aa4cd93374..6127c4ef301 100644
--- a/libgfortran/intrinsics/size.c
+++ b/libgfortran/intrinsics/size.c
@@ -35,7 +35,7 @@ size0 (const array_t * array)
size = 1;
for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)
{
- len = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(array,n);
if (len < 0)
len = 0;
size *= len;
@@ -54,7 +54,7 @@ size1 (const array_t * array, index_type dim)
dim--;
- size = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ size = GFC_DESCRIPTOR_EXTENT(array,dim);
if (size < 0)
size = 0;
return size;
diff --git a/libgfortran/intrinsics/spread_generic.c b/libgfortran/intrinsics/spread_generic.c
index 9fb4b11b265..9e20b8584c2 100644
--- a/libgfortran/intrinsics/spread_generic.c
+++ b/libgfortran/intrinsics/spread_generic.c
@@ -30,8 +30,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
static void
spread_internal (gfc_array_char *ret, const gfc_array_char *source,
- const index_type *along, const index_type *pncopies,
- index_type size)
+ const index_type *along, const index_type *pncopies)
{
/* r.* indicates the return array. */
index_type rstride[GFC_MAX_DIMENSIONS];
@@ -52,6 +51,9 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source,
index_type n;
index_type dim;
index_type ncopies;
+ index_type size;
+
+ size = GFC_DESCRIPTOR_SIZE(source);
srank = GFC_DESCRIPTOR_RANK(source);
@@ -68,31 +70,34 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source,
{
/* The front end has signalled that we need to populate the
return array descriptor. */
+
+ size_t ub, stride;
+
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank;
dim = 0;
rs = 1;
for (n = 0; n < rrank; n++)
{
- ret->dim[n].stride = rs;
- ret->dim[n].lbound = 0;
+ stride = rs;
if (n == *along - 1)
{
- ret->dim[n].ubound = ncopies - 1;
+ ub = ncopies - 1;
rdelta = rs * size;
rs *= ncopies;
}
else
{
count[dim] = 0;
- extent[dim] = source->dim[dim].ubound + 1
- - source->dim[dim].lbound;
- sstride[dim] = source->dim[dim].stride * size;
+ extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
+ sstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(source,dim);
rstride[dim] = rs * size;
- ret->dim[n].ubound = extent[dim]-1;
+ ub = extent[dim]-1;
rs *= extent[dim];
dim++;
}
+
+ GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
}
ret->offset = 0;
if (rs > 0)
@@ -119,10 +124,10 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source,
{
index_type ret_extent;
- ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n);
if (n == *along - 1)
{
- rdelta = ret->dim[n].stride * size;
+ rdelta = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n);
if (ret_extent != ncopies)
runtime_error("Incorrect extent in return value of SPREAD"
@@ -133,8 +138,7 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source,
else
{
count[dim] = 0;
- extent[dim] = source->dim[dim].ubound + 1
- - source->dim[dim].lbound;
+ extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
if (ret_extent != extent[dim])
runtime_error("Incorrect extent in return value of SPREAD"
" intrinsic in dimension %ld: is %ld,"
@@ -144,8 +148,8 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source,
if (extent[dim] <= 0)
zero_sized = 1;
- sstride[dim] = source->dim[dim].stride * size;
- rstride[dim] = ret->dim[n].stride * size;
+ sstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(source,dim);
+ rstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n);
dim++;
}
}
@@ -156,17 +160,16 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source,
{
if (n == *along - 1)
{
- rdelta = ret->dim[n].stride * size;
+ rdelta = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n);
}
else
{
count[dim] = 0;
- extent[dim] = source->dim[dim].ubound + 1
- - source->dim[dim].lbound;
+ extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
if (extent[dim] <= 0)
zero_sized = 1;
- sstride[dim] = source->dim[dim].stride * size;
- rstride[dim] = ret->dim[n].stride * size;
+ sstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(source,dim);
+ rstride[dim] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,n);
dim++;
}
}
@@ -228,12 +231,14 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source,
static void
spread_internal_scalar (gfc_array_char *ret, const char *source,
- const index_type *along, const index_type *pncopies,
- index_type size)
+ const index_type *along, const index_type *pncopies)
{
int n;
int ncopies = *pncopies;
char * dest;
+ size_t size;
+
+ size = GFC_DESCRIPTOR_SIZE(ret);
if (GFC_DESCRIPTOR_RANK (ret) != 1)
runtime_error ("incorrect destination rank in spread()");
@@ -245,20 +250,18 @@ spread_internal_scalar (gfc_array_char *ret, const char *source,
{
ret->data = internal_malloc_size (ncopies * size);
ret->offset = 0;
- ret->dim[0].stride = 1;
- ret->dim[0].lbound = 0;
- ret->dim[0].ubound = ncopies - 1;
+ GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
}
else
{
- if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound)
- / ret->dim[0].stride)
+ if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1)
+ / GFC_DESCRIPTOR_STRIDE(ret,0))
runtime_error ("dim too large in spread()");
}
for (n = 0; n < ncopies; n++)
{
- dest = (char*)(ret->data + n*size*ret->dim[0].stride);
+ dest = (char*)(ret->data + n * GFC_DESCRIPTOR_STRIDE_BYTES(ret,0));
memcpy (dest , source, size);
}
}
@@ -400,7 +403,7 @@ spread (gfc_array_char *ret, const gfc_array_char *source,
#endif
}
- spread_internal (ret, source, along, pncopies, GFC_DESCRIPTOR_SIZE (source));
+ spread_internal (ret, source, along, pncopies);
}
@@ -413,9 +416,10 @@ void
spread_char (gfc_array_char *ret,
GFC_INTEGER_4 ret_length __attribute__((unused)),
const gfc_array_char *source, const index_type *along,
- const index_type *pncopies, GFC_INTEGER_4 source_length)
+ const index_type *pncopies,
+ GFC_INTEGER_4 source_length __attribute__((unused)))
{
- spread_internal (ret, source, along, pncopies, source_length);
+ spread_internal (ret, source, along, pncopies);
}
@@ -428,10 +432,10 @@ void
spread_char4 (gfc_array_char *ret,
GFC_INTEGER_4 ret_length __attribute__((unused)),
const gfc_array_char *source, const index_type *along,
- const index_type *pncopies, GFC_INTEGER_4 source_length)
+ const index_type *pncopies,
+ GFC_INTEGER_4 source_length __attribute__((unused)))
{
- spread_internal (ret, source, along, pncopies,
- source_length * sizeof (gfc_char4_t));
+ spread_internal (ret, source, along, pncopies);
}
@@ -577,7 +581,7 @@ spread_scalar (gfc_array_char *ret, const char *source,
#endif
}
- spread_internal_scalar (ret, source, along, pncopies, GFC_DESCRIPTOR_SIZE (ret));
+ spread_internal_scalar (ret, source, along, pncopies);
}
@@ -590,11 +594,12 @@ void
spread_char_scalar (gfc_array_char *ret,
GFC_INTEGER_4 ret_length __attribute__((unused)),
const char *source, const index_type *along,
- const index_type *pncopies, GFC_INTEGER_4 source_length)
+ const index_type *pncopies,
+ GFC_INTEGER_4 source_length __attribute__((unused)))
{
if (!ret->dtype)
runtime_error ("return array missing descriptor in spread()");
- spread_internal_scalar (ret, source, along, pncopies, source_length);
+ spread_internal_scalar (ret, source, along, pncopies);
}
@@ -607,11 +612,12 @@ void
spread_char4_scalar (gfc_array_char *ret,
GFC_INTEGER_4 ret_length __attribute__((unused)),
const char *source, const index_type *along,
- const index_type *pncopies, GFC_INTEGER_4 source_length)
+ const index_type *pncopies,
+ GFC_INTEGER_4 source_length __attribute__((unused)))
{
if (!ret->dtype)
runtime_error ("return array missing descriptor in spread()");
- spread_internal_scalar (ret, source, along, pncopies,
- source_length * sizeof (gfc_char4_t));
+ spread_internal_scalar (ret, source, along, pncopies);
+
}
diff --git a/libgfortran/intrinsics/stat.c b/libgfortran/intrinsics/stat.c
index 5d0f3b63bdd..22d4f79796c 100644
--- a/libgfortran/intrinsics/stat.c
+++ b/libgfortran/intrinsics/stat.c
@@ -66,7 +66,7 @@ stat_i4_sub_0 (char *name, gfc_array_i4 *sarray, GFC_INTEGER_4 *status,
runtime_error ("Array rank of SARRAY is not 1.");
/* If the array is too small, abort. */
- if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13)
+ if (GFC_DESCRIPTOR_EXTENT(sarray,0) < 13)
runtime_error ("Array size of SARRAY is too small.");
/* Trim trailing spaces from name. */
@@ -88,55 +88,57 @@ stat_i4_sub_0 (char *name, gfc_array_i4 *sarray, GFC_INTEGER_4 *status,
if (val == 0)
{
+ index_type stride = GFC_DESCRIPTOR_STRIDE(sarray,0);
+
/* Device ID */
- sarray->data[0 * sarray->dim[0].stride] = sb.st_dev;
+ sarray->data[0 * stride] = sb.st_dev;
/* Inode number */
- sarray->data[1 * sarray->dim[0].stride] = sb.st_ino;
+ sarray->data[1 * stride] = sb.st_ino;
/* File mode */
- sarray->data[2 * sarray->dim[0].stride] = sb.st_mode;
+ sarray->data[2 * stride] = sb.st_mode;
/* Number of (hard) links */
- sarray->data[3 * sarray->dim[0].stride] = sb.st_nlink;
+ sarray->data[3 * stride] = sb.st_nlink;
/* Owner's uid */
- sarray->data[4 * sarray->dim[0].stride] = sb.st_uid;
+ sarray->data[4 * stride] = sb.st_uid;
/* Owner's gid */
- sarray->data[5 * sarray->dim[0].stride] = sb.st_gid;
+ sarray->data[5 * stride] = sb.st_gid;
/* ID of device containing directory entry for file (0 if not available) */
#if HAVE_STRUCT_STAT_ST_RDEV
- sarray->data[6 * sarray->dim[0].stride] = sb.st_rdev;
+ sarray->data[6 * stride] = sb.st_rdev;
#else
- sarray->data[6 * sarray->dim[0].stride] = 0;
+ sarray->data[6 * stride] = 0;
#endif
/* File size (bytes) */
- sarray->data[7 * sarray->dim[0].stride] = sb.st_size;
+ sarray->data[7 * stride] = sb.st_size;
/* Last access time */
- sarray->data[8 * sarray->dim[0].stride] = sb.st_atime;
+ sarray->data[8 * stride] = sb.st_atime;
/* Last modification time */
- sarray->data[9 * sarray->dim[0].stride] = sb.st_mtime;
+ sarray->data[9 * stride] = sb.st_mtime;
/* Last file status change time */
- sarray->data[10 * sarray->dim[0].stride] = sb.st_ctime;
+ sarray->data[10 * stride] = sb.st_ctime;
/* Preferred I/O block size (-1 if not available) */
#if HAVE_STRUCT_STAT_ST_BLKSIZE
- sarray->data[11 * sarray->dim[0].stride] = sb.st_blksize;
+ sarray->data[11 * stride] = sb.st_blksize;
#else
- sarray->data[11 * sarray->dim[0].stride] = -1;
+ sarray->data[11 * stride] = -1;
#endif
/* Number of blocks allocated (-1 if not available) */
#if HAVE_STRUCT_STAT_ST_BLOCKS
- sarray->data[12 * sarray->dim[0].stride] = sb.st_blocks;
+ sarray->data[12 * stride] = sb.st_blocks;
#else
- sarray->data[12 * sarray->dim[0].stride] = -1;
+ sarray->data[12 * stride] = -1;
#endif
}
@@ -185,7 +187,7 @@ stat_i8_sub_0 (char *name, gfc_array_i8 *sarray, GFC_INTEGER_8 *status,
runtime_error ("Array rank of SARRAY is not 1.");
/* If the array is too small, abort. */
- if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13)
+ if (GFC_DESCRIPTOR_EXTENT(sarray,0) < 13)
runtime_error ("Array size of SARRAY is too small.");
/* Trim trailing spaces from name. */
@@ -207,55 +209,57 @@ stat_i8_sub_0 (char *name, gfc_array_i8 *sarray, GFC_INTEGER_8 *status,
if (val == 0)
{
+ index_type stride = GFC_DESCRIPTOR_STRIDE(sarray,0);
+
/* Device ID */
sarray->data[0] = sb.st_dev;
/* Inode number */
- sarray->data[sarray->dim[0].stride] = sb.st_ino;
+ sarray->data[stride] = sb.st_ino;
/* File mode */
- sarray->data[2 * sarray->dim[0].stride] = sb.st_mode;
+ sarray->data[2 * stride] = sb.st_mode;
/* Number of (hard) links */
- sarray->data[3 * sarray->dim[0].stride] = sb.st_nlink;
+ sarray->data[3 * stride] = sb.st_nlink;
/* Owner's uid */
- sarray->data[4 * sarray->dim[0].stride] = sb.st_uid;
+ sarray->data[4 * stride] = sb.st_uid;
/* Owner's gid */
- sarray->data[5 * sarray->dim[0].stride] = sb.st_gid;
+ sarray->data[5 * stride] = sb.st_gid;
/* ID of device containing directory entry for file (0 if not available) */
#if HAVE_STRUCT_STAT_ST_RDEV
- sarray->data[6 * sarray->dim[0].stride] = sb.st_rdev;
+ sarray->data[6 * stride] = sb.st_rdev;
#else
- sarray->data[6 * sarray->dim[0].stride] = 0;
+ sarray->data[6 * stride] = 0;
#endif
/* File size (bytes) */
- sarray->data[7 * sarray->dim[0].stride] = sb.st_size;
+ sarray->data[7 * stride] = sb.st_size;
/* Last access time */
- sarray->data[8 * sarray->dim[0].stride] = sb.st_atime;
+ sarray->data[8 * stride] = sb.st_atime;
/* Last modification time */
- sarray->data[9 * sarray->dim[0].stride] = sb.st_mtime;
+ sarray->data[9 * stride] = sb.st_mtime;
/* Last file status change time */
- sarray->data[10 * sarray->dim[0].stride] = sb.st_ctime;
+ sarray->data[10 * stride] = sb.st_ctime;
/* Preferred I/O block size (-1 if not available) */
#if HAVE_STRUCT_STAT_ST_BLKSIZE
- sarray->data[11 * sarray->dim[0].stride] = sb.st_blksize;
+ sarray->data[11 * stride] = sb.st_blksize;
#else
- sarray->data[11 * sarray->dim[0].stride] = -1;
+ sarray->data[11 * stride] = -1;
#endif
/* Number of blocks allocated (-1 if not available) */
#if HAVE_STRUCT_STAT_ST_BLOCKS
- sarray->data[12 * sarray->dim[0].stride] = sb.st_blocks;
+ sarray->data[12 * stride] = sb.st_blocks;
#else
- sarray->data[12 * sarray->dim[0].stride] = -1;
+ sarray->data[12 * stride] = -1;
#endif
}
@@ -376,7 +380,7 @@ fstat_i4_sub (GFC_INTEGER_4 *unit, gfc_array_i4 *sarray, GFC_INTEGER_4 *status)
runtime_error ("Array rank of SARRAY is not 1.");
/* If the array is too small, abort. */
- if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13)
+ if (GFC_DESCRIPTOR_EXTENT(sarray,0) < 13)
runtime_error ("Array size of SARRAY is too small.");
/* Convert Fortran unit number to C file descriptor. */
@@ -386,55 +390,57 @@ fstat_i4_sub (GFC_INTEGER_4 *unit, gfc_array_i4 *sarray, GFC_INTEGER_4 *status)
if (val == 0)
{
+ index_type stride = GFC_DESCRIPTOR_STRIDE(sarray,0);
+
/* Device ID */
- sarray->data[0 * sarray->dim[0].stride] = sb.st_dev;
+ sarray->data[0 * stride] = sb.st_dev;
/* Inode number */
- sarray->data[1 * sarray->dim[0].stride] = sb.st_ino;
+ sarray->data[1 * stride] = sb.st_ino;
/* File mode */
- sarray->data[2 * sarray->dim[0].stride] = sb.st_mode;
+ sarray->data[2 * stride] = sb.st_mode;
/* Number of (hard) links */
- sarray->data[3 * sarray->dim[0].stride] = sb.st_nlink;
+ sarray->data[3 * stride] = sb.st_nlink;
/* Owner's uid */
- sarray->data[4 * sarray->dim[0].stride] = sb.st_uid;
+ sarray->data[4 * stride] = sb.st_uid;
/* Owner's gid */
- sarray->data[5 * sarray->dim[0].stride] = sb.st_gid;
+ sarray->data[5 * stride] = sb.st_gid;
/* ID of device containing directory entry for file (0 if not available) */
#if HAVE_STRUCT_STAT_ST_RDEV
- sarray->data[6 * sarray->dim[0].stride] = sb.st_rdev;
+ sarray->data[6 * stride] = sb.st_rdev;
#else
- sarray->data[6 * sarray->dim[0].stride] = 0;
+ sarray->data[6 * stride] = 0;
#endif
/* File size (bytes) */
- sarray->data[7 * sarray->dim[0].stride] = sb.st_size;
+ sarray->data[7 * stride] = sb.st_size;
/* Last access time */
- sarray->data[8 * sarray->dim[0].stride] = sb.st_atime;
+ sarray->data[8 * stride] = sb.st_atime;
/* Last modification time */
- sarray->data[9 * sarray->dim[0].stride] = sb.st_mtime;
+ sarray->data[9 * stride] = sb.st_mtime;
/* Last file status change time */
- sarray->data[10 * sarray->dim[0].stride] = sb.st_ctime;
+ sarray->data[10 * stride] = sb.st_ctime;
/* Preferred I/O block size (-1 if not available) */
#if HAVE_STRUCT_STAT_ST_BLKSIZE
- sarray->data[11 * sarray->dim[0].stride] = sb.st_blksize;
+ sarray->data[11 * stride] = sb.st_blksize;
#else
- sarray->data[11 * sarray->dim[0].stride] = -1;
+ sarray->data[11 * stride] = -1;
#endif
/* Number of blocks allocated (-1 if not available) */
#if HAVE_STRUCT_STAT_ST_BLOCKS
- sarray->data[12 * sarray->dim[0].stride] = sb.st_blocks;
+ sarray->data[12 * stride] = sb.st_blocks;
#else
- sarray->data[12 * sarray->dim[0].stride] = -1;
+ sarray->data[12 * stride] = -1;
#endif
}
@@ -457,7 +463,7 @@ fstat_i8_sub (GFC_INTEGER_8 *unit, gfc_array_i8 *sarray, GFC_INTEGER_8 *status)
runtime_error ("Array rank of SARRAY is not 1.");
/* If the array is too small, abort. */
- if (sarray->dim[0].ubound + 1 - sarray->dim[0].lbound < 13)
+ if (GFC_DESCRIPTOR_EXTENT(sarray,0) < 13)
runtime_error ("Array size of SARRAY is too small.");
/* Convert Fortran unit number to C file descriptor. */
@@ -467,55 +473,57 @@ fstat_i8_sub (GFC_INTEGER_8 *unit, gfc_array_i8 *sarray, GFC_INTEGER_8 *status)
if (val == 0)
{
+ index_type stride = GFC_DESCRIPTOR_STRIDE(sarray,0);
+
/* Device ID */
sarray->data[0] = sb.st_dev;
/* Inode number */
- sarray->data[sarray->dim[0].stride] = sb.st_ino;
+ sarray->data[stride] = sb.st_ino;
/* File mode */
- sarray->data[2 * sarray->dim[0].stride] = sb.st_mode;
+ sarray->data[2 * stride] = sb.st_mode;
/* Number of (hard) links */
- sarray->data[3 * sarray->dim[0].stride] = sb.st_nlink;
+ sarray->data[3 * stride] = sb.st_nlink;
/* Owner's uid */
- sarray->data[4 * sarray->dim[0].stride] = sb.st_uid;
+ sarray->data[4 * stride] = sb.st_uid;
/* Owner's gid */
- sarray->data[5 * sarray->dim[0].stride] = sb.st_gid;
+ sarray->data[5 * stride] = sb.st_gid;
/* ID of device containing directory entry for file (0 if not available) */
#if HAVE_STRUCT_STAT_ST_RDEV
- sarray->data[6 * sarray->dim[0].stride] = sb.st_rdev;
+ sarray->data[6 * stride] = sb.st_rdev;
#else
- sarray->data[6 * sarray->dim[0].stride] = 0;
+ sarray->data[6 * stride] = 0;
#endif
/* File size (bytes) */
- sarray->data[7 * sarray->dim[0].stride] = sb.st_size;
+ sarray->data[7 * stride] = sb.st_size;
/* Last access time */
- sarray->data[8 * sarray->dim[0].stride] = sb.st_atime;
+ sarray->data[8 * stride] = sb.st_atime;
/* Last modification time */
- sarray->data[9 * sarray->dim[0].stride] = sb.st_mtime;
+ sarray->data[9 * stride] = sb.st_mtime;
/* Last file status change time */
- sarray->data[10 * sarray->dim[0].stride] = sb.st_ctime;
+ sarray->data[10 * stride] = sb.st_ctime;
/* Preferred I/O block size (-1 if not available) */
#if HAVE_STRUCT_STAT_ST_BLKSIZE
- sarray->data[11 * sarray->dim[0].stride] = sb.st_blksize;
+ sarray->data[11 * stride] = sb.st_blksize;
#else
- sarray->data[11 * sarray->dim[0].stride] = -1;
+ sarray->data[11 * stride] = -1;
#endif
/* Number of blocks allocated (-1 if not available) */
#if HAVE_STRUCT_STAT_ST_BLOCKS
- sarray->data[12 * sarray->dim[0].stride] = sb.st_blocks;
+ sarray->data[12 * stride] = sb.st_blocks;
#else
- sarray->data[12 * sarray->dim[0].stride] = -1;
+ sarray->data[12 * stride] = -1;
#endif
}
diff --git a/libgfortran/intrinsics/transpose_generic.c b/libgfortran/intrinsics/transpose_generic.c
index 25856192a6c..b0c2fff5719 100644
--- a/libgfortran/intrinsics/transpose_generic.c
+++ b/libgfortran/intrinsics/transpose_generic.c
@@ -32,8 +32,7 @@ extern void transpose (gfc_array_char *, gfc_array_char *);
export_proto(transpose);
static void
-transpose_internal (gfc_array_char *ret, gfc_array_char *source,
- index_type size)
+transpose_internal (gfc_array_char *ret, gfc_array_char *source)
{
/* r.* indicates the return array. */
index_type rxstride, rystride;
@@ -44,21 +43,22 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source,
index_type xcount, ycount;
index_type x, y;
+ index_type size;
assert (GFC_DESCRIPTOR_RANK (source) == 2
&& GFC_DESCRIPTOR_RANK (ret) == 2);
+ size = GFC_DESCRIPTOR_SIZE(ret);
+
if (ret->data == NULL)
{
assert (ret->dtype == source->dtype);
- ret->dim[0].lbound = 0;
- ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound;
- ret->dim[0].stride = 1;
+ GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1,
+ 1);
- ret->dim[1].lbound = 0;
- ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound;
- ret->dim[1].stride = ret->dim[0].ubound+1;
+ GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
+ GFC_DESCRIPTOR_EXTENT(source, 1));
ret->data = internal_malloc_size (size * size0 ((array_t*)ret));
ret->offset = 0;
@@ -67,8 +67,8 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source,
{
index_type ret_extent, src_extent;
- ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound;
- src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0);
+ src_extent = GFC_DESCRIPTOR_EXTENT(source,1);
if (src_extent != ret_extent)
runtime_error ("Incorrect extent in return value of TRANSPOSE"
@@ -76,8 +76,8 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source,
" should be %ld", (long int) src_extent,
(long int) ret_extent);
- ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound;
- src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1);
+ src_extent = GFC_DESCRIPTOR_EXTENT(source,0);
if (src_extent != ret_extent)
runtime_error ("Incorrect extent in return value of TRANSPOSE"
@@ -87,13 +87,13 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source,
}
- sxstride = source->dim[0].stride * size;
- systride = source->dim[1].stride * size;
- xcount = source->dim[0].ubound + 1 - source->dim[0].lbound;
- ycount = source->dim[1].ubound + 1 - source->dim[1].lbound;
+ sxstride = GFC_DESCRIPTOR_STRIDE_BYTES(source,0);
+ systride = GFC_DESCRIPTOR_STRIDE_BYTES(source,1);
+ xcount = GFC_DESCRIPTOR_EXTENT(source,0);
+ ycount = GFC_DESCRIPTOR_EXTENT(source,1);
- rxstride = ret->dim[0].stride * size;
- rystride = ret->dim[1].stride * size;
+ rxstride = GFC_DESCRIPTOR_STRIDE_BYTES(ret,0);
+ rystride = GFC_DESCRIPTOR_STRIDE_BYTES(ret,1);
rptr = ret->data;
sptr = source->data;
@@ -119,7 +119,7 @@ export_proto(transpose);
void
transpose (gfc_array_char *ret, gfc_array_char *source)
{
- transpose_internal (ret, source, GFC_DESCRIPTOR_SIZE (source));
+ transpose_internal (ret, source);
}
@@ -130,9 +130,10 @@ export_proto(transpose_char);
void
transpose_char (gfc_array_char *ret,
GFC_INTEGER_4 ret_length __attribute__((unused)),
- gfc_array_char *source, GFC_INTEGER_4 source_length)
+ gfc_array_char *source,
+ GFC_INTEGER_4 source_length __attribute__((unused)))
{
- transpose_internal (ret, source, source_length);
+ transpose_internal (ret, source);
}
@@ -143,7 +144,8 @@ export_proto(transpose_char4);
void
transpose_char4 (gfc_array_char *ret,
GFC_INTEGER_4 ret_length __attribute__((unused)),
- gfc_array_char *source, GFC_INTEGER_4 source_length)
+ gfc_array_char *source,
+ GFC_INTEGER_4 source_length __attribute__((unused)))
{
- transpose_internal (ret, source, source_length * sizeof (gfc_char4_t));
+ transpose_internal (ret, source);
}
diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c
index a27e37c7272..47d4a6dddef 100644
--- a/libgfortran/intrinsics/unpack_generic.c
+++ b/libgfortran/intrinsics/unpack_generic.c
@@ -89,14 +89,13 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
for (n = 0; n < dim; n++)
{
count[n] = 0;
- ret->dim[n].stride = rs;
- ret->dim[n].lbound = 0;
- ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound;
- extent[n] = ret->dim[n].ubound + 1;
+ GFC_DIMENSION_SET(ret->dim[n], 0,
+ GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n);
empty = empty || extent[n] <= 0;
- rstride[n] = ret->dim[n].stride * size;
- fstride[n] = field->dim[n].stride * fsize;
- mstride[n] = mask->dim[n].stride * mask_kind;
+ rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret, n);
+ fstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(field, n);
+ mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n);
rs *= extent[n];
}
ret->offset = 0;
@@ -108,11 +107,11 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
for (n = 0; n < dim; n++)
{
count[n] = 0;
- extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n);
empty = empty || extent[n] <= 0;
- rstride[n] = ret->dim[n].stride * size;
- fstride[n] = field->dim[n].stride * fsize;
- mstride[n] = mask->dim[n].stride * mask_kind;
+ rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret, n);
+ fstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(field, n);
+ mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n);
}
if (rstride[0] == 0)
rstride[0] = size;
@@ -126,7 +125,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
if (mstride[0] == 0)
mstride[0] = 1;
- vstride0 = vector->dim[0].stride * size;
+ vstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(vector,0);
if (vstride0 == 0)
vstride0 = size;
rstride0 = rstride[0];
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index f6d5687ba8e..c39a51d34e2 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -2093,10 +2093,10 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
}
/* Check the values of the triplet indices. */
- if ((ls[dim].start > (ssize_t)ad[dim].ubound)
- || (ls[dim].start < (ssize_t)ad[dim].lbound)
- || (ls[dim].end > (ssize_t)ad[dim].ubound)
- || (ls[dim].end < (ssize_t)ad[dim].lbound))
+ if ((ls[dim].start > (ssize_t) GFC_DIMENSION_UBOUND(ad[dim]))
+ || (ls[dim].start < (ssize_t) GFC_DIMENSION_LBOUND(ad[dim]))
+ || (ls[dim].end > (ssize_t) GFC_DIMENSION_UBOUND(ad[dim]))
+ || (ls[dim].end < (ssize_t) GFC_DIMENSION_LBOUND(ad[dim])))
{
if (is_char)
sprintf (parse_err_msg, "Substring out of range");
@@ -2160,8 +2160,8 @@ nml_touch_nodes (namelist_info * nl)
for (dim=0; dim < nl->var_rank; dim++)
{
nl->ls[dim].step = 1;
- nl->ls[dim].end = nl->dim[dim].ubound;
- nl->ls[dim].start = nl->dim[dim].lbound;
+ nl->ls[dim].end = GFC_DESCRIPTOR_UBOUND(nl,dim);
+ nl->ls[dim].start = GFC_DESCRIPTOR_LBOUND(nl,dim);
nl->ls[dim].idx = nl->ls[dim].start;
}
}
@@ -2356,8 +2356,9 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset,
pdata = (void*)(nl->mem_pos + offset);
for (dim = 0; dim < nl->var_rank; dim++)
- pdata = (void*)(pdata + (nl->ls[dim].idx - nl->dim[dim].lbound) *
- nl->dim[dim].stride * nl->size);
+ pdata = (void*)(pdata + (nl->ls[dim].idx
+ - GFC_DESCRIPTOR_LBOUND(nl,dim))
+ * GFC_DESCRIPTOR_STRIDE(nl,dim) * nl->size);
/* Reset the error flag and try to read next value, if
dtp->u.p.repeat_count=0 */
@@ -2679,8 +2680,8 @@ get_name:
for (dim=0; dim < nl->var_rank; dim++)
{
nl->ls[dim].step = 1;
- nl->ls[dim].end = nl->dim[dim].ubound;
- nl->ls[dim].start = nl->dim[dim].lbound;
+ nl->ls[dim].end = GFC_DESCRIPTOR_UBOUND(nl,dim);
+ nl->ls[dim].start = GFC_DESCRIPTOR_LBOUND(nl,dim);
nl->ls[dim].idx = nl->ls[dim].start;
}
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 08ba7f56f59..585ae43acbf 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -1778,10 +1778,8 @@ transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind,
for (n = 0; n < rank; n++)
{
count[n] = 0;
- stride[n] = iotype == BT_CHARACTER ?
- desc->dim[n].stride * GFC_SIZE_OF_CHAR_KIND(kind) :
- desc->dim[n].stride;
- extent[n] = desc->dim[n].ubound + 1 - desc->dim[n].lbound;
+ stride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(desc,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(desc,n);
/* If the extent of even one dimension is zero, then the entire
array section contains zero elements, so we return after writing
@@ -1797,9 +1795,9 @@ transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind,
stride0 = stride[0];
- /* If the innermost dimension has stride 1, we can do the transfer
+ /* If the innermost dimension has a stride of 1, we can do the transfer
in contiguous chunks. */
- if (stride0 == 1)
+ if (stride0 == size)
tsize = extent[0];
else
tsize = 1;
@@ -1809,13 +1807,13 @@ transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind,
while (data)
{
dtp->u.p.transfer (dtp, iotype, data, kind, size, tsize);
- data += stride0 * size * tsize;
+ data += stride0 * tsize;
count[0] += tsize;
n = 0;
while (count[n] == extent[n])
{
count[n] = 0;
- data -= stride[n] * extent[n] * size;
+ data -= stride[n] * extent[n];
n++;
if (n == rank)
{
@@ -1825,7 +1823,7 @@ transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind,
else
{
count[n]++;
- data += stride[n] * size;
+ data += stride[n];
}
}
}
@@ -2490,23 +2488,24 @@ init_loop_spec (gfc_array_char *desc, array_loop_spec *ls,
for (i=0; i<rank; i++)
{
- ls[i].idx = desc->dim[i].lbound;
- ls[i].start = desc->dim[i].lbound;
- ls[i].end = desc->dim[i].ubound;
- ls[i].step = desc->dim[i].stride;
- empty = empty || (desc->dim[i].ubound < desc->dim[i].lbound);
+ ls[i].idx = GFC_DESCRIPTOR_LBOUND(desc,i);
+ ls[i].start = GFC_DESCRIPTOR_LBOUND(desc,i);
+ ls[i].end = GFC_DESCRIPTOR_UBOUND(desc,i);
+ ls[i].step = GFC_DESCRIPTOR_STRIDE(desc,i);
+ empty = empty || (GFC_DESCRIPTOR_UBOUND(desc,i)
+ < GFC_DESCRIPTOR_LBOUND(desc,i));
- if (desc->dim[i].stride > 0)
+ if (GFC_DESCRIPTOR_STRIDE(desc,i) > 0)
{
- index += (desc->dim[i].ubound - desc->dim[i].lbound)
- * desc->dim[i].stride;
+ index += (GFC_DESCRIPTOR_EXTENT(desc,i) - 1)
+ * GFC_DESCRIPTOR_STRIDE(desc,i);
}
else
{
- index -= (desc->dim[i].ubound - desc->dim[i].lbound)
- * desc->dim[i].stride;
- *start_record -= (desc->dim[i].ubound - desc->dim[i].lbound)
- * desc->dim[i].stride;
+ index -= (GFC_DESCRIPTOR_EXTENT(desc,i) - 1)
+ * GFC_DESCRIPTOR_STRIDE(desc,i);
+ *start_record -= (GFC_DESCRIPTOR_EXTENT(desc,i) - 1)
+ * GFC_DESCRIPTOR_STRIDE(desc,i);
}
}
@@ -3400,9 +3399,7 @@ st_set_nml_var_dim (st_parameter_dt *dtp, GFC_INTEGER_4 n_dim,
for (nml = dtp->u.p.ionml; nml->next; nml = nml->next);
- nml->dim[n].stride = stride;
- nml->dim[n].lbound = lbound;
- nml->dim[n].ubound = ubound;
+ GFC_DIMENSION_SET(nml->dim[n],lbound,ubound,stride);
}
/* Reverse memcpy - used for byte swapping. */
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index b6d6e687736..4956da8cf80 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -1316,8 +1316,8 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
nelem = 1;
for (dim_i = 0; dim_i < (size_t) obj->var_rank; dim_i++)
{
- obj->ls[dim_i].idx = obj->dim[dim_i].lbound;
- nelem = nelem * (obj->dim[dim_i].ubound + 1 - obj->dim[dim_i].lbound);
+ obj->ls[dim_i].idx = GFC_DESCRIPTOR_LBOUND(obj, dim_i);
+ nelem = nelem * GFC_DESCRIPTOR_EXTENT (obj, dim_i);
}
/* Main loop to output the data held in the object. */
@@ -1484,9 +1484,9 @@ obj_loop:
{
obj->ls[dim_i].idx += nml_carry ;
nml_carry = 0;
- if (obj->ls[dim_i].idx > (index_type) obj->dim[dim_i].ubound)
+ if (obj->ls[dim_i].idx > (ssize_t) GFC_DESCRIPTOR_UBOUND(obj,dim_i))
{
- obj->ls[dim_i].idx = obj->dim[dim_i].lbound;
+ obj->ls[dim_i].idx = GFC_DESCRIPTOR_LBOUND(obj,dim_i);
nml_carry = 1;
}
}
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index fcf736a3f1d..517ee76d91d 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -297,10 +297,11 @@ internal_proto(big_endian);
typedef struct descriptor_dimension
{
- index_type stride;
- index_type lbound;
- index_type ubound;
+ index_type _stride;
+ index_type _lbound;
+ index_type _ubound;
}
+
descriptor_dimension;
#define GFC_ARRAY_DESCRIPTOR(r, type) \
@@ -353,6 +354,30 @@ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_16) gfc_array_l16;
#define GFC_DESCRIPTOR_DATA(desc) ((desc)->data)
#define GFC_DESCRIPTOR_DTYPE(desc) ((desc)->dtype)
+#define GFC_DIMENSION_LBOUND(dim) ((dim)._lbound)
+#define GFC_DIMENSION_UBOUND(dim) ((dim)._ubound)
+#define GFC_DIMENSION_STRIDE(dim) ((dim)._stride)
+#define GFC_DIMENSION_EXTENT(dim) ((dim)._ubound + 1 - (dim)._lbound)
+#define GFC_DIMENSION_SET(dim,lb,ub,str) \
+ do \
+ { \
+ (dim)._lbound = lb; \
+ (dim)._ubound = ub; \
+ (dim)._stride = str; \
+ } while (0)
+
+
+#define GFC_DESCRIPTOR_LBOUND(desc,i) ((desc)->dim[i]._lbound)
+#define GFC_DESCRIPTOR_UBOUND(desc,i) ((desc)->dim[i]._ubound)
+#define GFC_DESCRIPTOR_EXTENT(desc,i) ((desc)->dim[i]._ubound + 1 \
+ - (desc)->dim[i]._lbound)
+#define GFC_DESCRIPTOR_EXTENT_BYTES(desc,i) \
+ (GFC_DESCRIPTOR_EXTENT(desc,i) * GFC_DESCRIPTOR_SIZE(desc))
+
+#define GFC_DESCRIPTOR_STRIDE(desc,i) ((desc)->dim[i]._stride)
+#define GFC_DESCRIPTOR_STRIDE_BYTES(desc,i) \
+ (GFC_DESCRIPTOR_STRIDE(desc,i) * GFC_DESCRIPTOR_SIZE(desc))
+
/* Macros to get both the size and the type with a single masking operation */
#define GFC_DTYPE_SIZE_MASK \
diff --git a/libgfortran/m4/cshift0.m4 b/libgfortran/m4/cshift0.m4
index da385cbfbfe..0c5e0158eec 100644
--- a/libgfortran/m4/cshift0.m4
+++ b/libgfortran/m4/cshift0.m4
@@ -70,20 +70,20 @@ cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, ssize_t shift,
{
if (dim == which)
{
- roffset = ret->dim[dim].stride;
+ roffset = GFC_DESCRIPTOR_STRIDE(ret,dim);
if (roffset == 0)
roffset = 1;
- soffset = array->dim[dim].stride;
+ soffset = GFC_DESCRIPTOR_STRIDE(array,dim);
if (soffset == 0)
soffset = 1;
- len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(array,dim);
}
else
{
count[n] = 0;
- extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
- rstride[n] = ret->dim[dim].stride;
- sstride[n] = array->dim[dim].stride;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim);
+ rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim);
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(array,dim);
n++;
}
}
diff --git a/libgfortran/m4/cshift1.m4 b/libgfortran/m4/cshift1.m4
index 3c5ff5e6618..22b61854ffe 100644
--- a/libgfortran/m4/cshift1.m4
+++ b/libgfortran/m4/cshift1.m4
@@ -36,8 +36,7 @@ static void
cshift1 (gfc_array_char * const restrict ret,
const gfc_array_char * const restrict array,
const 'atype` * const restrict h,
- const 'atype_name` * const restrict pwhich,
- index_type size)
+ const 'atype_name` * const restrict pwhich)
{
/* r.* indicates the return array. */
index_type rstride[GFC_MAX_DIMENSIONS];
@@ -64,6 +63,7 @@ cshift1 (gfc_array_char * const restrict ret,
int which;
'atype_name` sh;
index_type arraysize;
+ index_type size;
if (pwhich)
which = *pwhich - 1;
@@ -73,6 +73,8 @@ cshift1 (gfc_array_char * const restrict ret,
if (which < 0 || (which + 1) > GFC_DESCRIPTOR_RANK (array))
runtime_error ("Argument ''`DIM''` is out of range in call to ''`CSHIFT''`");
+ size = GFC_DESCRIPTOR_SIZE(array);
+
arraysize = size0 ((array_t *)array);
if (ret->data == NULL)
@@ -84,13 +86,17 @@ cshift1 (gfc_array_char * const restrict ret,
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
{
- ret->dim[i].lbound = 0;
- ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
+ index_type ub, str;
+
+ ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1;
if (i == 0)
- ret->dim[i].stride = 1;
+ str = 1;
else
- ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
+ str = GFC_DESCRIPTOR_EXTENT(ret,i-1) *
+ GFC_DESCRIPTOR_STRIDE(ret,i-1);
+
+ GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
}
}
@@ -110,22 +116,22 @@ cshift1 (gfc_array_char * const restrict ret,
{
if (dim == which)
{
- roffset = ret->dim[dim].stride * size;
+ roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
if (roffset == 0)
roffset = size;
- soffset = array->dim[dim].stride * size;
+ soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
if (soffset == 0)
soffset = size;
- len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(array,dim);
}
else
{
count[n] = 0;
- extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
- rstride[n] = ret->dim[dim].stride * size;
- sstride[n] = array->dim[dim].stride * size;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim);
+ rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
+ sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
- hstride[n] = h->dim[n].stride;
+ hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n);
n++;
}
}
@@ -211,7 +217,7 @@ cshift1_'atype_kind` (gfc_array_char * const restrict ret,
const 'atype` * const restrict h,
const 'atype_name` * const restrict pwhich)
{
- cshift1 (ret, array, h, pwhich, GFC_DESCRIPTOR_SIZE (array));
+ cshift1 (ret, array, h, pwhich);
}
@@ -229,9 +235,9 @@ cshift1_'atype_kind`_char (gfc_array_char * const restrict ret,
const gfc_array_char * const restrict array,
const 'atype` * const restrict h,
const 'atype_name` * const restrict pwhich,
- GFC_INTEGER_4 array_length)
+ GFC_INTEGER_4 array_length __attribute__((unused)))
{
- cshift1 (ret, array, h, pwhich, array_length);
+ cshift1 (ret, array, h, pwhich);
}
@@ -249,9 +255,9 @@ cshift1_'atype_kind`_char4 (gfc_array_char * const restrict ret,
const gfc_array_char * const restrict array,
const 'atype` * const restrict h,
const 'atype_name` * const restrict pwhich,
- GFC_INTEGER_4 array_length)
+ GFC_INTEGER_4 array_length __attribute__((unused)))
{
- cshift1 (ret, array, h, pwhich, array_length * sizeof (gfc_char4_t));
+ cshift1 (ret, array, h, pwhich);
}
#endif'
diff --git a/libgfortran/m4/eoshift1.m4 b/libgfortran/m4/eoshift1.m4
index 1ecf0a95421..831277cf413 100644
--- a/libgfortran/m4/eoshift1.m4
+++ b/libgfortran/m4/eoshift1.m4
@@ -38,7 +38,7 @@ eoshift1 (gfc_array_char * const restrict ret,
const 'atype` * const restrict h,
const char * const restrict pbound,
const 'atype_name` * const restrict pwhich,
- index_type size, const char * filler, index_type filler_len)
+ const char * filler, index_type filler_len)
{
/* r.* indicates the return array. */
index_type rstride[GFC_MAX_DIMENSIONS];
@@ -62,6 +62,7 @@ eoshift1 (gfc_array_char * const restrict ret,
index_type dim;
index_type len;
index_type n;
+ index_type size;
int which;
'atype_name` sh;
'atype_name` delta;
@@ -72,6 +73,8 @@ eoshift1 (gfc_array_char * const restrict ret,
soffset = 0;
roffset = 0;
+ size = GFC_DESCRIPTOR_SIZE(array);
+
if (pwhich)
which = *pwhich - 1;
else
@@ -89,13 +92,18 @@ eoshift1 (gfc_array_char * const restrict ret,
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
{
- ret->dim[i].lbound = 0;
- ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
+ index_type ub, str;
+
+ ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1;
if (i == 0)
- ret->dim[i].stride = 1;
+ str = 1;
else
- ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
+ str = GFC_DESCRIPTOR_EXTENT(ret,i-1)
+ * GFC_DESCRIPTOR_STRIDE(ret,i-1);
+
+ GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
+
}
}
else
@@ -109,22 +117,22 @@ eoshift1 (gfc_array_char * const restrict ret,
{
if (dim == which)
{
- roffset = ret->dim[dim].stride * size;
+ roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
if (roffset == 0)
roffset = size;
- soffset = array->dim[dim].stride * size;
+ soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
if (soffset == 0)
soffset = size;
- len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(array,dim);
}
else
{
count[n] = 0;
- extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
- rstride[n] = ret->dim[dim].stride * size;
- sstride[n] = array->dim[dim].stride * size;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim);
+ rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
+ sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
- hstride[n] = h->dim[n].stride;
+ hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n);
n++;
}
}
@@ -242,8 +250,7 @@ eoshift1_'atype_kind` (gfc_array_char * const restrict ret,
const char * const restrict pbound,
const 'atype_name` * const restrict pwhich)
{
- eoshift1 (ret, array, h, pbound, pwhich, GFC_DESCRIPTOR_SIZE (array),
- "\0", 1);
+ eoshift1 (ret, array, h, pbound, pwhich, "\0", 1);
}
@@ -263,10 +270,10 @@ eoshift1_'atype_kind`_char (gfc_array_char * const restrict ret,
const 'atype` * const restrict h,
const char * const restrict pbound,
const 'atype_name` * const restrict pwhich,
- GFC_INTEGER_4 array_length,
+ GFC_INTEGER_4 array_length __attribute__((unused)),
GFC_INTEGER_4 bound_length __attribute__((unused)))
{
- eoshift1 (ret, array, h, pbound, pwhich, array_length, " ", 1);
+ eoshift1 (ret, array, h, pbound, pwhich, " ", 1);
}
@@ -286,11 +293,11 @@ eoshift1_'atype_kind`_char4 (gfc_array_char * const restrict ret,
const 'atype` * const restrict h,
const char * const restrict pbound,
const 'atype_name` * const restrict pwhich,
- GFC_INTEGER_4 array_length,
+ GFC_INTEGER_4 array_length __attribute__((unused)),
GFC_INTEGER_4 bound_length __attribute__((unused)))
{
static const gfc_char4_t space = (unsigned char) ''` ''`;
- eoshift1 (ret, array, h, pbound, pwhich, array_length * sizeof (gfc_char4_t),
+ eoshift1 (ret, array, h, pbound, pwhich,
(const char *) &space, sizeof (gfc_char4_t));
}
diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4
index 902c3cdbffa..e6b29599ef0 100644
--- a/libgfortran/m4/eoshift3.m4
+++ b/libgfortran/m4/eoshift3.m4
@@ -38,7 +38,7 @@ eoshift3 (gfc_array_char * const restrict ret,
const 'atype` * const restrict h,
const gfc_array_char * const restrict bound,
const 'atype_name` * const restrict pwhich,
- index_type size, const char * filler, index_type filler_len)
+ const char * filler, index_type filler_len)
{
/* r.* indicates the return array. */
index_type rstride[GFC_MAX_DIMENSIONS];
@@ -66,6 +66,7 @@ eoshift3 (gfc_array_char * const restrict ret,
index_type dim;
index_type len;
index_type n;
+ index_type size;
int which;
'atype_name` sh;
'atype_name` delta;
@@ -76,6 +77,8 @@ eoshift3 (gfc_array_char * const restrict ret,
soffset = 0;
roffset = 0;
+ size = GFC_DESCRIPTOR_SIZE(array);
+
if (pwhich)
which = *pwhich - 1;
else
@@ -90,13 +93,18 @@ eoshift3 (gfc_array_char * const restrict ret,
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
{
- ret->dim[i].lbound = 0;
- ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
+ index_type ub, str;
+
+ ub = GFC_DESCRIPTOR_EXTENT(array,i) - 1;
if (i == 0)
- ret->dim[i].stride = 1;
+ str = 1;
else
- ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
+ str = GFC_DESCRIPTOR_EXTENT(ret,i-1)
+ * GFC_DESCRIPTOR_STRIDE(ret,i-1);
+
+ GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
+
}
}
else
@@ -113,24 +121,24 @@ eoshift3 (gfc_array_char * const restrict ret,
{
if (dim == which)
{
- roffset = ret->dim[dim].stride * size;
+ roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
if (roffset == 0)
roffset = size;
- soffset = array->dim[dim].stride * size;
+ soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
if (soffset == 0)
soffset = size;
- len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(array,dim);
}
else
{
count[n] = 0;
- extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
- rstride[n] = ret->dim[dim].stride * size;
- sstride[n] = array->dim[dim].stride * size;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,dim);
+ rstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
+ sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
- hstride[n] = h->dim[n].stride;
+ hstride[n] = GFC_DESCRIPTOR_STRIDE(h,n);
if (bound)
- bstride[n] = bound->dim[n].stride * size;
+ bstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(bound,n);
else
bstride[n] = 0;
n++;
@@ -261,8 +269,7 @@ eoshift3_'atype_kind` (gfc_array_char * const restrict ret,
const gfc_array_char * const restrict bound,
const 'atype_name` * const restrict pwhich)
{
- eoshift3 (ret, array, h, bound, pwhich, GFC_DESCRIPTOR_SIZE (array),
- "\0", 1);
+ eoshift3 (ret, array, h, bound, pwhich, "\0", 1);
}
@@ -282,10 +289,10 @@ eoshift3_'atype_kind`_char (gfc_array_char * const restrict ret,
const 'atype` * const restrict h,
const gfc_array_char * const restrict bound,
const 'atype_name` * const restrict pwhich,
- GFC_INTEGER_4 array_length,
+ GFC_INTEGER_4 array_length __attribute__((unused)),
GFC_INTEGER_4 bound_length __attribute__((unused)))
{
- eoshift3 (ret, array, h, bound, pwhich, array_length, " ", 1);
+ eoshift3 (ret, array, h, bound, pwhich, " ", 1);
}
@@ -305,11 +312,11 @@ eoshift3_'atype_kind`_char4 (gfc_array_char * const restrict ret,
const 'atype` * const restrict h,
const gfc_array_char * const restrict bound,
const 'atype_name` * const restrict pwhich,
- GFC_INTEGER_4 array_length,
+ GFC_INTEGER_4 array_length __attribute__((unused)),
GFC_INTEGER_4 bound_length __attribute__((unused)))
{
static const gfc_char4_t space = (unsigned char) ''` ''`;
- eoshift3 (ret, array, h, bound, pwhich, array_length * sizeof (gfc_char4_t),
+ eoshift3 (ret, array, h, bound, pwhich,
(const char *) &space, sizeof (gfc_char4_t));
}
diff --git a/libgfortran/m4/iforeach.m4 b/libgfortran/m4/iforeach.m4
index b620c653f1a..0960d22aeb4 100644
--- a/libgfortran/m4/iforeach.m4
+++ b/libgfortran/m4/iforeach.m4
@@ -27,9 +27,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
if (retarray->data == NULL)
{
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = rank-1;
- retarray->dim[0].stride = 1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
retarray->offset = 0;
retarray->data = internal_malloc_size (sizeof (rtype_name) * rank);
@@ -46,7 +44,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
runtime_error ("rank of return array in u_name intrinsic"
" should be 1, is %ld", (long int) ret_rank);
- ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0);
if (ret_extent != rank)
runtime_error ("Incorrect extent in return value of"
" u_name intrnisic: is %ld, should be %ld",
@@ -54,12 +52,12 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
}
}
- dstride = retarray->dim[0].stride;
+ dstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
dest = retarray->data;
for (n = 0; n < rank; n++)
{
- sstride[n] = array->dim[n].stride;
- extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
count[n] = 0;
if (extent[n] <= 0)
{
@@ -143,9 +141,7 @@ void
if (retarray->data == NULL)
{
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = rank-1;
- retarray->dim[0].stride = 1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
retarray->offset = 0;
retarray->data = internal_malloc_size (sizeof (rtype_name) * rank);
@@ -164,7 +160,7 @@ void
runtime_error ("rank of return array in u_name intrinsic"
" should be 1, is %ld", (long int) ret_rank);
- ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0);
if (ret_extent != rank)
runtime_error ("Incorrect extent in return value of"
" u_name intrnisic: is %ld, should be %ld",
@@ -178,8 +174,8 @@ void
for (n=0; n<rank; n++)
{
- array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound;
- mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound;
+ array_extent = GFC_DESCRIPTOR_EXTENT(array,n);
+ mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n);
if (array_extent != mask_extent)
runtime_error ("Incorrect extent in MASK argument of"
" u_name intrinsic in dimension %ld:"
@@ -202,13 +198,13 @@ void
else
runtime_error ("Funny sized logical array");
- dstride = retarray->dim[0].stride;
+ dstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
dest = retarray->data;
for (n = 0; n < rank; n++)
{
- sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride * mask_kind;
- extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
+ mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
count[n] = 0;
if (extent[n] <= 0)
{
@@ -302,9 +298,7 @@ void
if (retarray->data == NULL)
{
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = rank-1;
- retarray->dim[0].stride = 1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
retarray->offset = 0;
retarray->data = internal_malloc_size (sizeof (rtype_name) * rank);
@@ -321,13 +315,13 @@ void
runtime_error ("rank of return array in u_name intrinsic"
" should be 1, is %ld", (long int) ret_rank);
- ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0);
if (ret_extent != rank)
runtime_error ("dimension of return array incorrect");
}
}
- dstride = retarray->dim[0].stride;
+ dstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
dest = retarray->data;
for (n = 0; n<rank; n++)
dest[n * dstride] = $1 ;
diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4
index e0c168e2e48..6785eb3c43f 100644
--- a/libgfortran/m4/ifunction.m4
+++ b/libgfortran/m4/ifunction.m4
@@ -45,24 +45,23 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
- len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(array,dim);
if (len < 0)
len = 0;
- delta = array->dim[dim].stride;
+ delta = GFC_DESCRIPTOR_STRIDE(array,dim);
for (n = 0; n < dim; n++)
{
- sstride[n] = array->dim[n].stride;
- extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] < 0)
extent[n] = 0;
}
for (n = dim; n < rank; n++)
{
- sstride[n] = array->dim[n + 1].stride;
- extent[n] =
- array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(array, n + 1);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1);
if (extent[n] < 0)
extent[n] = 0;
@@ -70,30 +69,31 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
if (retarray->data == NULL)
{
- size_t alloc_size;
+ size_t alloc_size, str;
for (n = 0; n < rank; n++)
{
- retarray->dim[n].lbound = 0;
- retarray->dim[n].ubound = extent[n]-1;
if (n == 0)
- retarray->dim[n].stride = 1;
+ str = 1;
else
- retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+ str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
+
+ GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);
+
}
retarray->offset = 0;
retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
- alloc_size = sizeof (rtype_name) * retarray->dim[rank-1].stride
+ alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
* extent[rank-1];
if (alloc_size == 0)
{
/* Make sure we have a zero-sized array. */
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = -1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
return;
+
}
else
retarray->data = internal_malloc_size (alloc_size);
@@ -112,8 +112,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
{
index_type ret_extent;
- ret_extent = retarray->dim[n].ubound + 1
- - retarray->dim[n].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n);
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" u_name intrinsic in dimension %ld:"
@@ -126,7 +125,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
for (n = 0; n < rank; n++)
{
count[n] = 0;
- dstride[n] = retarray->dim[n].stride;
+ dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
if (extent[n] <= 0)
len = 0;
}
@@ -217,7 +216,7 @@ void
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
- len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(array,dim);
if (len <= 0)
return;
@@ -234,14 +233,14 @@ void
else
runtime_error ("Funny sized logical array");
- delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride * mask_kind;
+ delta = GFC_DESCRIPTOR_STRIDE(array,dim);
+ mdelta = GFC_DESCRIPTOR_STRIDE_BYTES(mask,dim);
for (n = 0; n < dim; n++)
{
- sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride * mask_kind;
- extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
+ mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] < 0)
extent[n] = 0;
@@ -249,10 +248,9 @@ void
}
for (n = dim; n < rank; n++)
{
- sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride * mask_kind;
- extent[n] =
- array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1);
+ mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask, n + 1);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array, n + 1);
if (extent[n] < 0)
extent[n] = 0;
@@ -260,19 +258,20 @@ void
if (retarray->data == NULL)
{
- size_t alloc_size;
+ size_t alloc_size, str;
for (n = 0; n < rank; n++)
{
- retarray->dim[n].lbound = 0;
- retarray->dim[n].ubound = extent[n]-1;
if (n == 0)
- retarray->dim[n].stride = 1;
+ str = 1;
else
- retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+ str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
+
+ GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);
+
}
- alloc_size = sizeof (rtype_name) * retarray->dim[rank-1].stride
+ alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
* extent[rank-1];
retarray->offset = 0;
@@ -281,8 +280,7 @@ void
if (alloc_size == 0)
{
/* Make sure we have a zero-sized array. */
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = -1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
return;
}
else
@@ -300,8 +298,7 @@ void
{
index_type ret_extent;
- ret_extent = retarray->dim[n].ubound + 1
- - retarray->dim[n].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n);
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" u_name intrinsic in dimension %ld:"
@@ -312,8 +309,8 @@ void
{
index_type mask_extent, array_extent;
- array_extent = array->dim[n].ubound + 1 - array->dim[n].lbound;
- mask_extent = mask->dim[n].ubound + 1 - mask->dim[n].lbound;
+ array_extent = GFC_DESCRIPTOR_EXTENT(array,n);
+ mask_extent = GFC_DESCRIPTOR_EXTENT(mask,n);
if (array_extent != mask_extent)
runtime_error ("Incorrect extent in MASK argument of"
" u_name intrinsic in dimension %ld:"
@@ -326,7 +323,7 @@ void
for (n = 0; n < rank; n++)
{
count[n] = 0;
- dstride[n] = retarray->dim[n].stride;
+ dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
if (extent[n] <= 0)
return;
}
@@ -423,8 +420,8 @@ void
for (n = 0; n < dim; n++)
{
- sstride[n] = array->dim[n].stride;
- extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
extent[n] = 0;
@@ -432,9 +429,9 @@ void
for (n = dim; n < rank; n++)
{
- sstride[n] = array->dim[n + 1].stride;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1);
extent[n] =
- array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+ GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
extent[n] = 0;
@@ -442,29 +439,29 @@ void
if (retarray->data == NULL)
{
- size_t alloc_size;
+ size_t alloc_size, str;
for (n = 0; n < rank; n++)
{
- retarray->dim[n].lbound = 0;
- retarray->dim[n].ubound = extent[n]-1;
if (n == 0)
- retarray->dim[n].stride = 1;
+ str = 1;
else
- retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+ str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
+
+ GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);
+
}
retarray->offset = 0;
retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
- alloc_size = sizeof (rtype_name) * retarray->dim[rank-1].stride
+ alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
* extent[rank-1];
if (alloc_size == 0)
{
/* Make sure we have a zero-sized array. */
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = -1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
return;
}
else
@@ -484,8 +481,7 @@ void
{
index_type ret_extent;
- ret_extent = retarray->dim[n].ubound + 1
- - retarray->dim[n].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n);
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" u_name intrinsic in dimension %ld:"
@@ -498,7 +494,7 @@ void
for (n = 0; n < rank; n++)
{
count[n] = 0;
- dstride[n] = retarray->dim[n].stride;
+ dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
}
dest = retarray->data;
diff --git a/libgfortran/m4/ifunction_logical.m4 b/libgfortran/m4/ifunction_logical.m4
index da6b4ae2640..d1d2dd09c44 100644
--- a/libgfortran/m4/ifunction_logical.m4
+++ b/libgfortran/m4/ifunction_logical.m4
@@ -48,25 +48,24 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
src_kind = GFC_DESCRIPTOR_SIZE (array);
- len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+ len = GFC_DESCRIPTOR_EXTENT(array,dim);
if (len < 0)
len = 0;
- delta = array->dim[dim].stride * src_kind;
+ delta = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
for (n = 0; n < dim; n++)
{
- sstride[n] = array->dim[n].stride * src_kind;
- extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] < 0)
extent[n] = 0;
}
for (n = dim; n < rank; n++)
{
- sstride[n] = array->dim[n + 1].stride * src_kind;
- extent[n] =
- array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n + 1);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] < 0)
extent[n] = 0;
@@ -74,29 +73,29 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
if (retarray->data == NULL)
{
- size_t alloc_size;
+ size_t alloc_size, str;
for (n = 0; n < rank; n++)
{
- retarray->dim[n].lbound = 0;
- retarray->dim[n].ubound = extent[n]-1;
if (n == 0)
- retarray->dim[n].stride = 1;
+ str = 1;
else
- retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+ str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
+
+ GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);
+
}
retarray->offset = 0;
retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
- alloc_size = sizeof (rtype_name) * retarray->dim[rank-1].stride
+ alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
* extent[rank-1];
if (alloc_size == 0)
{
/* Make sure we have a zero-sized array. */
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = -1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
return;
}
else
@@ -116,8 +115,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
{
index_type ret_extent;
- ret_extent = retarray->dim[n].ubound + 1
- - retarray->dim[n].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,n);
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" u_name intrinsic in dimension %d:"
@@ -130,7 +128,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
for (n = 0; n < rank; n++)
{
count[n] = 0;
- dstride[n] = retarray->dim[n].stride;
+ dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
if (extent[n] <= 0)
len = 0;
}
diff --git a/libgfortran/m4/in_pack.m4 b/libgfortran/m4/in_pack.m4
index b54ea04d723..a4337aad8f7 100644
--- a/libgfortran/m4/in_pack.m4
+++ b/libgfortran/m4/in_pack.m4
@@ -60,8 +60,8 @@ internal_pack_'rtype_ccode` ('rtype` * source)
for (n = 0; n < dim; n++)
{
count[n] = 0;
- stride[n] = source->dim[n].stride;
- extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound;
+ stride[n] = GFC_DESCRIPTOR_STRIDE(source,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(source,n);
if (extent[n] <= 0)
{
/* Do nothing. */
diff --git a/libgfortran/m4/in_unpack.m4 b/libgfortran/m4/in_unpack.m4
index af7114501a2..661c54e1da5 100644
--- a/libgfortran/m4/in_unpack.m4
+++ b/libgfortran/m4/in_unpack.m4
@@ -55,8 +55,8 @@ internal_unpack_'rtype_ccode` ('rtype` * d, const 'rtype_name` * src)
for (n = 0; n < dim; n++)
{
count[n] = 0;
- stride[n] = d->dim[n].stride;
- extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound;
+ stride[n] = GFC_DESCRIPTOR_STRIDE(d,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(d,n);
if (extent[n] <= 0)
return;
diff --git a/libgfortran/m4/matmul.m4 b/libgfortran/m4/matmul.m4
index 8ad1bd117c2..bb42f2a6c47 100644
--- a/libgfortran/m4/matmul.m4
+++ b/libgfortran/m4/matmul.m4
@@ -106,25 +106,22 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
{
if (GFC_DESCRIPTOR_RANK (a) == 1)
{
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound;
- retarray->dim[0].stride = 1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0,
+ GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1);
}
else if (GFC_DESCRIPTOR_RANK (b) == 1)
{
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
- retarray->dim[0].stride = 1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0,
+ GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1);
}
else
{
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
- retarray->dim[0].stride = 1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0,
+ GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1);
- retarray->dim[1].lbound = 0;
- retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound;
- retarray->dim[1].stride = retarray->dim[0].ubound+1;
+ GFC_DIMENSION_SET(retarray->dim[1], 0,
+ GFC_DESCRIPTOR_EXTENT(b,1) - 1,
+ GFC_DESCRIPTOR_EXTENT(retarray,0));
}
retarray->data
@@ -137,8 +134,8 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
if (GFC_DESCRIPTOR_RANK (a) == 1)
{
- arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound;
- ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound;
+ arg_extent = GFC_DESCRIPTOR_EXTENT(b,1);
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0);
if (arg_extent != ret_extent)
runtime_error ("Incorrect extent in return array in"
" MATMUL intrinsic: is %ld, should be %ld",
@@ -146,8 +143,8 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
}
else if (GFC_DESCRIPTOR_RANK (b) == 1)
{
- arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound;
- ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound;
+ arg_extent = GFC_DESCRIPTOR_EXTENT(a,0);
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0);
if (arg_extent != ret_extent)
runtime_error ("Incorrect extent in return array in"
" MATMUL intrinsic: is %ld, should be %ld",
@@ -155,16 +152,16 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
}
else
{
- arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound;
- ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound;
+ arg_extent = GFC_DESCRIPTOR_EXTENT(a,0);
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0);
if (arg_extent != ret_extent)
runtime_error ("Incorrect extent in return array in"
" MATMUL intrinsic for dimension 1:"
" is %ld, should be %ld",
(long int) ret_extent, (long int) arg_extent);
- arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound;
- ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound;
+ arg_extent = GFC_DESCRIPTOR_EXTENT(b,1);
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1);
if (arg_extent != ret_extent)
runtime_error ("Incorrect extent in return array in"
" MATMUL intrinsic for dimension 2:"
@@ -180,43 +177,43 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
/* One-dimensional result may be addressed in the code below
either as a row or a column matrix. We want both cases to
work. */
- rxstride = rystride = retarray->dim[0].stride;
+ rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
}
else
{
- rxstride = retarray->dim[0].stride;
- rystride = retarray->dim[1].stride;
+ rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+ rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
}
if (GFC_DESCRIPTOR_RANK (a) == 1)
{
/* Treat it as a a row matrix A[1,count]. */
- axstride = a->dim[0].stride;
+ axstride = GFC_DESCRIPTOR_STRIDE(a,0);
aystride = 1;
xcount = 1;
- count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+ count = GFC_DESCRIPTOR_EXTENT(a,0);
}
else
{
- axstride = a->dim[0].stride;
- aystride = a->dim[1].stride;
+ axstride = GFC_DESCRIPTOR_STRIDE(a,0);
+ aystride = GFC_DESCRIPTOR_STRIDE(a,1);
- count = a->dim[1].ubound + 1 - a->dim[1].lbound;
- xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
+ count = GFC_DESCRIPTOR_EXTENT(a,1);
+ xcount = GFC_DESCRIPTOR_EXTENT(a,0);
}
- if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ if (count != GFC_DESCRIPTOR_EXTENT(b,0))
{
- if (count > 0 || b->dim[0].ubound + 1 - b->dim[0].lbound > 0)
+ if (count > 0 || GFC_DESCRIPTOR_EXTENT(b,0) > 0)
runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
}
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
/* Treat it as a column matrix B[count,1] */
- bxstride = b->dim[0].stride;
+ bxstride = GFC_DESCRIPTOR_STRIDE(b,0);
/* bystride should never be used for 1-dimensional b.
in case it is we want it to cause a segfault, rather than
@@ -226,9 +223,9 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
}
else
{
- bxstride = b->dim[0].stride;
- bystride = b->dim[1].stride;
- ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
+ bxstride = GFC_DESCRIPTOR_STRIDE(b,0);
+ bystride = GFC_DESCRIPTOR_STRIDE(b,1);
+ ycount = GFC_DESCRIPTOR_EXTENT(b,1);
}
abase = a->data;
diff --git a/libgfortran/m4/matmull.m4 b/libgfortran/m4/matmull.m4
index d971d3da7b4..c5bad25f78a 100644
--- a/libgfortran/m4/matmull.m4
+++ b/libgfortran/m4/matmull.m4
@@ -70,25 +70,22 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
{
if (GFC_DESCRIPTOR_RANK (a) == 1)
{
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound;
- retarray->dim[0].stride = 1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0,
+ GFC_DESCRIPTOR_EXTENT(b,1) - 1, 1);
}
else if (GFC_DESCRIPTOR_RANK (b) == 1)
{
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
- retarray->dim[0].stride = 1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0,
+ GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1);
}
else
{
- retarray->dim[0].lbound = 0;
- retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
- retarray->dim[0].stride = 1;
-
- retarray->dim[1].lbound = 0;
- retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound;
- retarray->dim[1].stride = retarray->dim[0].ubound+1;
+ GFC_DIMENSION_SET(retarray->dim[0], 0,
+ GFC_DESCRIPTOR_EXTENT(a,0) - 1, 1);
+
+ GFC_DIMENSION_SET(retarray->dim[1], 0,
+ GFC_DESCRIPTOR_EXTENT(b,1) - 1,
+ GFC_DESCRIPTOR_EXTENT(retarray,0));
}
retarray->data
@@ -101,8 +98,8 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
if (GFC_DESCRIPTOR_RANK (a) == 1)
{
- arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound;
- ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound;
+ arg_extent = GFC_DESCRIPTOR_EXTENT(b,1);
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0);
if (arg_extent != ret_extent)
runtime_error ("Incorrect extent in return array in"
" MATMUL intrinsic: is %ld, should be %ld",
@@ -110,8 +107,8 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
}
else if (GFC_DESCRIPTOR_RANK (b) == 1)
{
- arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound;
- ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound;
+ arg_extent = GFC_DESCRIPTOR_EXTENT(a,0);
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0);
if (arg_extent != ret_extent)
runtime_error ("Incorrect extent in return array in"
" MATMUL intrinsic: is %ld, should be %ld",
@@ -119,16 +116,16 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
}
else
{
- arg_extent = a->dim[0].ubound + 1 - a->dim[0].lbound;
- ret_extent = retarray->dim[0].ubound + 1 - retarray->dim[0].lbound;
+ arg_extent = GFC_DESCRIPTOR_EXTENT(a,0);
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,0);
if (arg_extent != ret_extent)
runtime_error ("Incorrect extent in return array in"
" MATMUL intrinsic for dimension 1:"
" is %ld, should be %ld",
(long int) ret_extent, (long int) arg_extent);
- arg_extent = b->dim[1].ubound + 1 - b->dim[1].lbound;
- ret_extent = retarray->dim[1].ubound + 1 - retarray->dim[1].lbound;
+ arg_extent = GFC_DESCRIPTOR_EXTENT(b,1);
+ ret_extent = GFC_DESCRIPTOR_EXTENT(retarray,1);
if (arg_extent != ret_extent)
runtime_error ("Incorrect extent in return array in"
" MATMUL intrinsic for dimension 2:"
@@ -167,46 +164,46 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
`
if (GFC_DESCRIPTOR_RANK (retarray) == 1)
{
- rxstride = retarray->dim[0].stride;
+ rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
rystride = rxstride;
}
else
{
- rxstride = retarray->dim[0].stride;
- rystride = retarray->dim[1].stride;
+ rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+ rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
}
/* If we have rank 1 parameters, zero the absent stride, and set the size to
one. */
if (GFC_DESCRIPTOR_RANK (a) == 1)
{
- astride = a->dim[0].stride * a_kind;
- count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+ astride = GFC_DESCRIPTOR_STRIDE_BYTES(a,0);
+ count = GFC_DESCRIPTOR_EXTENT(a,0);
xstride = 0;
rxstride = 0;
xcount = 1;
}
else
{
- astride = a->dim[1].stride * a_kind;
- count = a->dim[1].ubound + 1 - a->dim[1].lbound;
- xstride = a->dim[0].stride * a_kind;
- xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
+ astride = GFC_DESCRIPTOR_STRIDE_BYTES(a,1);
+ count = GFC_DESCRIPTOR_EXTENT(a,1);
+ xstride = GFC_DESCRIPTOR_STRIDE_BYTES(a,0);
+ xcount = GFC_DESCRIPTOR_EXTENT(a,0);
}
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
- bstride = b->dim[0].stride * b_kind;
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ bstride = GFC_DESCRIPTOR_STRIDE_BYTES(b,0);
+ assert(count == GFC_DESCRIPTOR_EXTENT(b,0));
ystride = 0;
rystride = 0;
ycount = 1;
}
else
{
- bstride = b->dim[0].stride * b_kind;
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
- ystride = b->dim[1].stride * b_kind;
- ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
+ bstride = GFC_DESCRIPTOR_STRIDE_BYTES(b,0);
+ assert(count == GFC_DESCRIPTOR_EXTENT(b,0));
+ ystride = GFC_DESCRIPTOR_STRIDE_BYTES(b,1);
+ ycount = GFC_DESCRIPTOR_EXTENT(b,1);
}
for (y = 0; y < ycount; y++)
diff --git a/libgfortran/m4/pack.m4 b/libgfortran/m4/pack.m4
index 16b80731f76..910ffdcaac1 100644
--- a/libgfortran/m4/pack.m4
+++ b/libgfortran/m4/pack.m4
@@ -123,11 +123,11 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array,
for (n = 0; n < dim; n++)
{
count[n] = 0;
- extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
zero_sized = 1;
- sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride * mask_kind;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
+ mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
}
if (sstride[0] == 0)
sstride[0] = 1;
@@ -148,7 +148,7 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array,
{
/* The return array will have as many
elements as there are in VECTOR. */
- total = vector->dim[0].ubound + 1 - vector->dim[0].lbound;
+ total = GFC_DESCRIPTOR_EXTENT(vector,0);
if (total < 0)
{
total = 0;
@@ -216,9 +216,7 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array,
if (ret->data == NULL)
{
/* Setup the array descriptor. */
- ret->dim[0].lbound = 0;
- ret->dim[0].ubound = total - 1;
- ret->dim[0].stride = 1;
+ GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
ret->offset = 0;
if (total == 0)
@@ -235,7 +233,7 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array,
/* We come here because of range checking. */
index_type ret_extent;
- ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0);
if (total != ret_extent)
runtime_error ("Incorrect extent in return value of PACK intrinsic;"
" is %ld, should be %ld", (long int) total,
@@ -243,7 +241,7 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array,
}
}
- rstride0 = ret->dim[0].stride;
+ rstride0 = GFC_DESCRIPTOR_STRIDE(ret,0);
if (rstride0 == 0)
rstride0 = 1;
sstride0 = sstride[0];
@@ -292,11 +290,11 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array,
/* Add any remaining elements from VECTOR. */
if (vector)
{
- n = vector->dim[0].ubound + 1 - vector->dim[0].lbound;
+ n = GFC_DESCRIPTOR_EXTENT(vector,0);
nelem = ((rptr - ret->data) / rstride0);
if (n > nelem)
{
- sstride0 = vector->dim[0].stride;
+ sstride0 = GFC_DESCRIPTOR_STRIDE(vector,0);
if (sstride0 == 0)
sstride0 = 1;
diff --git a/libgfortran/m4/reshape.m4 b/libgfortran/m4/reshape.m4
index 5240e386636..4052a5ecc15 100644
--- a/libgfortran/m4/reshape.m4
+++ b/libgfortran/m4/reshape.m4
@@ -1,4 +1,4 @@
-`/* Implementation of the RESHAPE
+`/* Implementation of the RESHAPE intrinsic
Copyright 2002, 2006, 2007, 2009 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
@@ -83,7 +83,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
int sempty, pempty, shape_empty;
index_type shape_data[GFC_MAX_DIMENSIONS];
- rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1;
+ rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
@@ -91,7 +91,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
for (n = 0; n < rdim; n++)
{
- shape_data[n] = shape->data[n * shape->dim[0].stride];
+ shape_data[n] = shape->data[n * GFC_DESCRIPTOR_STRIDE(shape,0)];
if (shape_data[n] <= 0)
{
shape_data[n] = 0;
@@ -104,10 +104,10 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
rs = 1;
for (n = 0; n < rdim; n++)
{
- ret->dim[n].lbound = 0;
rex = shape_data[n];
- ret->dim[n].ubound = rex - 1;
- ret->dim[n].stride = rs;
+
+ GFC_DIMENSION_SET(ret->dim[n], 0, rex - 1, rs);
+
rs *= rex;
}
ret->offset = 0;
@@ -126,8 +126,8 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
for (n = 0; n < pdim; n++)
{
pcount[n] = 0;
- pstride[n] = pad->dim[n].stride;
- pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound;
+ pstride[n] = GFC_DESCRIPTOR_STRIDE(pad,n);
+ pextent[n] = GFC_DESCRIPTOR_EXTENT(pad,n);
if (pextent[n] <= 0)
{
pempty = 1;
@@ -157,7 +157,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
for (n = 0; n < rdim; n++)
{
rs *= shape_data[n];
- ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n);
if (ret_extent != shape_data[n])
runtime_error("Incorrect extent in return value of RESHAPE"
" intrinsic in dimension %ld: is %ld,"
@@ -170,7 +170,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
for (n = 0; n < sdim; n++)
{
index_type se;
- se = source->dim[n].ubound + 1 - source->dim[0].lbound;
+ se = GFC_DESCRIPTOR_EXTENT(source,n);
source_extent *= se > 0 ? se : 0;
}
@@ -189,7 +189,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
for (n = 0; n < rdim; n++)
{
- v = order->data[n * order->dim[0].stride] - 1;
+ v = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1;
if (v < 0 || v >= rdim)
runtime_error("Value %ld out of range in ORDER argument"
@@ -208,13 +208,13 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
for (n = 0; n < rdim; n++)
{
if (order)
- dim = order->data[n * order->dim[0].stride] - 1;
+ dim = order->data[n * GFC_DESCRIPTOR_STRIDE(order,0)] - 1;
else
dim = n;
rcount[n] = 0;
- rstride[n] = ret->dim[dim].stride;
- rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound;
+ rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,dim);
+ rextent[n] = GFC_DESCRIPTOR_EXTENT(ret,dim);
if (rextent[n] < 0)
rextent[n] = 0;
@@ -235,8 +235,8 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
for (n = 0; n < sdim; n++)
{
scount[n] = 0;
- sstride[n] = source->dim[n].stride;
- sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound;
+ sstride[n] = GFC_DESCRIPTOR_STRIDE(source,n);
+ sextent[n] = GFC_DESCRIPTOR_EXTENT(source,n);
if (sextent[n] <= 0)
{
sempty = 1;
diff --git a/libgfortran/m4/shape.m4 b/libgfortran/m4/shape.m4
index b189f804e55..eadd3b9b945 100644
--- a/libgfortran/m4/shape.m4
+++ b/libgfortran/m4/shape.m4
@@ -43,14 +43,14 @@ shape_'rtype_kind` ('rtype` * const restrict ret,
index_type stride;
index_type extent;
- stride = ret->dim[0].stride;
+ stride = GFC_DESCRIPTOR_STRIDE(ret,0);
- if (ret->dim[0].ubound < ret->dim[0].lbound)
+ if (GFC_DESCRIPTOR_EXTENT(ret,0) < 1)
return;
for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)
{
- extent = array->dim[n].ubound + 1 - array->dim[n].lbound;
+ extent = GFC_DESCRIPTOR_EXTENT(array,n);
ret->data[n * stride] = extent > 0 ? extent : 0 ;
}
}
diff --git a/libgfortran/m4/spread.m4 b/libgfortran/m4/spread.m4
index 84ea00c3301..5e73d97423a 100644
--- a/libgfortran/m4/spread.m4
+++ b/libgfortran/m4/spread.m4
@@ -70,6 +70,9 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source,
if (ret->data == NULL)
{
+
+ size_t ub, stride;
+
/* The front end has signalled that we need to populate the
return array descriptor. */
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank;
@@ -77,26 +80,25 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source,
rs = 1;
for (n = 0; n < rrank; n++)
{
- ret->dim[n].stride = rs;
- ret->dim[n].lbound = 0;
+ stride = rs;
if (n == along - 1)
{
- ret->dim[n].ubound = ncopies - 1;
+ ub = ncopies - 1;
rdelta = rs;
rs *= ncopies;
}
else
{
count[dim] = 0;
- extent[dim] = source->dim[dim].ubound + 1
- - source->dim[dim].lbound;
- sstride[dim] = source->dim[dim].stride;
+ extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
+ sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim);
rstride[dim] = rs;
- ret->dim[n].ubound = extent[dim]-1;
+ ub = extent[dim] - 1;
rs *= extent[dim];
dim++;
}
+ GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
}
ret->offset = 0;
if (rs > 0)
@@ -123,10 +125,10 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source,
{
index_type ret_extent;
- ret_extent = ret->dim[n].ubound + 1 - ret->dim[n].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n);
if (n == along - 1)
{
- rdelta = ret->dim[n].stride;
+ rdelta = GFC_DESCRIPTOR_STRIDE(ret,n);
if (ret_extent != ncopies)
runtime_error("Incorrect extent in return value of SPREAD"
@@ -137,8 +139,7 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source,
else
{
count[dim] = 0;
- extent[dim] = source->dim[dim].ubound + 1
- - source->dim[dim].lbound;
+ extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
if (ret_extent != extent[dim])
runtime_error("Incorrect extent in return value of SPREAD"
" intrinsic in dimension %ld: is %ld,"
@@ -148,8 +149,8 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source,
if (extent[dim] <= 0)
zero_sized = 1;
- sstride[dim] = source->dim[dim].stride;
- rstride[dim] = ret->dim[n].stride;
+ sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim);
+ rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n);
dim++;
}
}
@@ -160,17 +161,16 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source,
{
if (n == along - 1)
{
- rdelta = ret->dim[n].stride;
+ rdelta = GFC_DESCRIPTOR_STRIDE(ret,n);
}
else
{
count[dim] = 0;
- extent[dim] = source->dim[dim].ubound + 1
- - source->dim[dim].lbound;
+ extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
if (extent[dim] <= 0)
zero_sized = 1;
- sstride[dim] = source->dim[dim].stride;
- rstride[dim] = ret->dim[n].stride;
+ sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim);
+ rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n);
dim++;
}
}
@@ -249,19 +249,17 @@ spread_scalar_'rtype_code` ('rtype` *ret, const 'rtype_name` *source,
{
ret->data = internal_malloc_size (ncopies * sizeof ('rtype_name`));
ret->offset = 0;
- ret->dim[0].stride = 1;
- ret->dim[0].lbound = 0;
- ret->dim[0].ubound = ncopies - 1;
+ GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
}
else
{
- if (ncopies - 1 > (ret->dim[0].ubound - ret->dim[0].lbound)
- / ret->dim[0].stride)
+ if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1)
+ / GFC_DESCRIPTOR_STRIDE(ret,0))
runtime_error ("dim too large in spread()");
}
dest = ret->data;
- stride = ret->dim[0].stride;
+ stride = GFC_DESCRIPTOR_STRIDE(ret,0);
for (n = 0; n < ncopies; n++)
{
diff --git a/libgfortran/m4/transpose.m4 b/libgfortran/m4/transpose.m4
index 8c50767fc9e..34c2d6c06aa 100644
--- a/libgfortran/m4/transpose.m4
+++ b/libgfortran/m4/transpose.m4
@@ -55,13 +55,11 @@ transpose_'rtype_code` ('rtype` * const restrict ret,
assert (GFC_DESCRIPTOR_RANK (ret) == 2);
assert (ret->dtype == source->dtype);
- ret->dim[0].lbound = 0;
- ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound;
- ret->dim[0].stride = 1;
+ GFC_DIMENSION_SET(ret->dim[0], 0, GFC_DESCRIPTOR_EXTENT(source,1) - 1,
+ 1);
- ret->dim[1].lbound = 0;
- ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound;
- ret->dim[1].stride = ret->dim[0].ubound+1;
+ GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
+ GFC_DESCRIPTOR_EXTENT(source, 1));
ret->data = internal_malloc_size (sizeof ('rtype_name`) * size0 ((array_t *) ret));
ret->offset = 0;
@@ -69,8 +67,8 @@ transpose_'rtype_code` ('rtype` * const restrict ret,
{
index_type ret_extent, src_extent;
- ret_extent = ret->dim[0].ubound + 1 - ret->dim[0].lbound;
- src_extent = source->dim[1].ubound + 1 - source->dim[1].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0);
+ src_extent = GFC_DESCRIPTOR_EXTENT(source,1);
if (src_extent != ret_extent)
runtime_error ("Incorrect extent in return value of TRANSPOSE"
@@ -78,8 +76,8 @@ transpose_'rtype_code` ('rtype` * const restrict ret,
" should be %ld", (long int) src_extent,
(long int) ret_extent);
- ret_extent = ret->dim[1].ubound + 1 - ret->dim[1].lbound;
- src_extent = source->dim[0].ubound + 1 - source->dim[0].lbound;
+ ret_extent = GFC_DESCRIPTOR_EXTENT(ret,1);
+ src_extent = GFC_DESCRIPTOR_EXTENT(source,0);
if (src_extent != ret_extent)
runtime_error ("Incorrect extent in return value of TRANSPOSE"
@@ -89,13 +87,13 @@ transpose_'rtype_code` ('rtype` * const restrict ret,
}
- sxstride = source->dim[0].stride;
- systride = source->dim[1].stride;
- xcount = source->dim[0].ubound + 1 - source->dim[0].lbound;
- ycount = source->dim[1].ubound + 1 - source->dim[1].lbound;
+ sxstride = GFC_DESCRIPTOR_STRIDE(source,0);
+ systride = GFC_DESCRIPTOR_STRIDE(source,1);
+ xcount = GFC_DESCRIPTOR_EXTENT(source,0);
+ ycount = GFC_DESCRIPTOR_EXTENT(source,1);
- rxstride = ret->dim[0].stride;
- rystride = ret->dim[1].stride;
+ rxstride = GFC_DESCRIPTOR_STRIDE(ret,0);
+ rystride = GFC_DESCRIPTOR_STRIDE(ret,1);
rptr = ret->data;
sptr = source->data;
diff --git a/libgfortran/m4/unpack.m4 b/libgfortran/m4/unpack.m4
index a26128c7835..bf348aebe1f 100644
--- a/libgfortran/m4/unpack.m4
+++ b/libgfortran/m4/unpack.m4
@@ -91,13 +91,12 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
for (n = 0; n < dim; n++)
{
count[n] = 0;
- ret->dim[n].stride = rs;
- ret->dim[n].lbound = 0;
- ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound;
- extent[n] = ret->dim[n].ubound + 1;
+ GFC_DIMENSION_SET(ret->dim[n], 0,
+ GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n);
empty = empty || extent[n] <= 0;
- rstride[n] = ret->dim[n].stride;
- mstride[n] = mask->dim[n].stride * mask_kind;
+ rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n);
+ mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
rs *= extent[n];
}
ret->offset = 0;
@@ -109,10 +108,10 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
for (n = 0; n < dim; n++)
{
count[n] = 0;
- extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n);
empty = empty || extent[n] <= 0;
- rstride[n] = ret->dim[n].stride;
- mstride[n] = mask->dim[n].stride * mask_kind;
+ rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n);
+ mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
}
if (rstride[0] == 0)
rstride[0] = 1;
@@ -124,7 +123,7 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
if (mstride[0] == 0)
mstride[0] = 1;
- vstride0 = vector->dim[0].stride;
+ vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0);
if (vstride0 == 0)
vstride0 = 1;
rstride0 = rstride[0];
@@ -236,14 +235,13 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
for (n = 0; n < dim; n++)
{
count[n] = 0;
- ret->dim[n].stride = rs;
- ret->dim[n].lbound = 0;
- ret->dim[n].ubound = mask->dim[n].ubound - mask->dim[n].lbound;
- extent[n] = ret->dim[n].ubound + 1;
+ GFC_DIMENSION_SET(ret->dim[n], 0,
+ GFC_DESCRIPTOR_EXTENT(mask,n) - 1, rs);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n);
empty = empty || extent[n] <= 0;
- rstride[n] = ret->dim[n].stride;
- fstride[n] = field->dim[n].stride;
- mstride[n] = mask->dim[n].stride * mask_kind;
+ rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n);
+ fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n);
+ mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
rs *= extent[n];
}
ret->offset = 0;
@@ -255,11 +253,11 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
for (n = 0; n < dim; n++)
{
count[n] = 0;
- extent[n] = ret->dim[n].ubound + 1 - ret->dim[n].lbound;
+ extent[n] = GFC_DESCRIPTOR_EXTENT(ret,n);
empty = empty || extent[n] <= 0;
- rstride[n] = ret->dim[n].stride;
- fstride[n] = field->dim[n].stride;
- mstride[n] = mask->dim[n].stride * mask_kind;
+ rstride[n] = GFC_DESCRIPTOR_STRIDE(ret,n);
+ fstride[n] = GFC_DESCRIPTOR_STRIDE(field,n);
+ mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
}
if (rstride[0] == 0)
rstride[0] = 1;
@@ -273,7 +271,7 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
if (mstride[0] == 0)
mstride[0] = 1;
- vstride0 = vector->dim[0].stride;
+ vstride0 = GFC_DESCRIPTOR_STRIDE(vector,0);
if (vstride0 == 0)
vstride0 = 1;
rstride0 = rstride[0];
diff --git a/libgfortran/runtime/in_pack_generic.c b/libgfortran/runtime/in_pack_generic.c
index 28e8d8e3663..33ce0310cd1 100644
--- a/libgfortran/runtime/in_pack_generic.c
+++ b/libgfortran/runtime/in_pack_generic.c
@@ -48,12 +48,6 @@ internal_pack (gfc_array_char * source)
index_type size;
index_type type_size;
- if (source->dim[0].stride == 0)
- {
- source->dim[0].stride = 1;
- return source->data;
- }
-
type_size = GFC_DTYPE_TYPE_SIZE(source);
size = GFC_DESCRIPTOR_SIZE (source);
switch (type_size)
@@ -147,8 +141,8 @@ internal_pack (gfc_array_char * source)
for (n = 0; n < dim; n++)
{
count[n] = 0;
- stride[n] = source->dim[n].stride;
- extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound;
+ stride[n] = GFC_DESCRIPTOR_STRIDE(source,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(source,n);
if (extent[n] <= 0)
{
/* Do nothing. */
diff --git a/libgfortran/runtime/in_unpack_generic.c b/libgfortran/runtime/in_unpack_generic.c
index 66b5c84b854..3c290cd7ebd 100644
--- a/libgfortran/runtime/in_unpack_generic.c
+++ b/libgfortran/runtime/in_unpack_generic.c
@@ -162,16 +162,13 @@ internal_unpack (gfc_array_char * d, const void * s)
size = GFC_DESCRIPTOR_SIZE (d);
- if (d->dim[0].stride == 0)
- d->dim[0].stride = 1;
-
dim = GFC_DESCRIPTOR_RANK (d);
dsize = 1;
for (n = 0; n < dim; n++)
{
count[n] = 0;
- stride[n] = d->dim[n].stride;
- extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound;
+ stride[n] = GFC_DESCRIPTOR_STRIDE(d,n);
+ extent[n] = GFC_DESCRIPTOR_EXTENT(d,n);
if (extent[n] <= 0)
return;