diff options
332 files changed, 1238 insertions, 1511 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index f610ba146e1..a7993432667 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,55 @@ +2014-06-17 Janne Blomqvist <jb@gcc.gnu.org> + + * libgfortran.h (xmallocarray): New prototype. + * runtime/memory.c (xmallocarray): New function. + (xcalloc): Check for nonzero separately instead of multiplying. + * generated/*.c: Regenerated. + * intrinsics/cshift0.c (cshift0): Call xmallocarray instead of + xmalloc. + * intrinsics/eoshift0.c (eoshift0): Likewise. + * intrinsics/eoshift2.c (eoshift2): Likewise. + * intrinsics/pack_generic.c (pack_internal): Likewise. + (pack_s_internal): Likewise. + * intrinsics/reshape_generic.c (reshape_internal): Likewise. + * intrinsics/spread_generic.c (spread_internal): Likewise. + (spread_internal_scalar): Likewise. + * intrinsics/string_intrinsics_inc.c (string_trim): Likewise. + (string_minmax): Likewise. + * intrinsics/transpose_generic.c (transpose_internal): Likewise. + * intrinsics/unpack_generic.c (unpack_internal): Likewise. + * io/list_read.c (nml_touch_nodes): Don't cast xmalloc return value. + * io/transfer.c (st_set_nml_var): Call xmallocarray instead of + xmalloc. + * io/unit.c (get_internal_unit): Likewise. + (filename_from_unit): Don't cast xmalloc return value. + * io/write.c (nml_write_obj): Likewise, formatting. + * m4/bessel.m4 (bessel_jn_r'rtype_kind`): Call xmallocarray + instead of xmalloc. + (besse_yn_r'rtype_kind`): Likewise. + * m4/cshift1.m4 (cshift1): Likewise. + * m4/eoshift1.m4 (eoshift1): Likewise. + * m4/eoshift3.m4 (eoshift3): Likewise. + * m4/iforeach.m4: Likewise. + * m4/ifunction.m4: Likewise. + * m4/ifunction_logical.m4 (name`'rtype_qual`_'atype_code): + Likewise. + * m4/in_pack.m4 (internal_pack_'rtype_ccode`): Likewise. + * m4/matmul.m4 (matmul_'rtype_code`): Likewise. + * m4/matmull.m4 (matmul_'rtype_code`): Likewise. + * m4/pack.m4 (pack_'rtype_code`): Likewise. + * m4/reshape.m4 (reshape_'rtype_ccode`): Likewise. + * m4/shape.m4 (shape_'rtype_kind`): Likewise. + * m4/spread.m4 (spread_'rtype_code`): Likewise. + (spread_scalar_'rtype_code`): Likewise. + * m4/transpose.m4 (transpose_'rtype_code`): Likewise. + * m4/unpack.m4 (unpack0_'rtype_code`): Likewise. + (unpack1_'rtype_code`): Likewise. + * runtime/convert_char.c (convert_char1_to_char4): Likewise. + (convert_char4_to_char1): Simplify. + * runtime/environ.c (init_unformatted): Call xmallocarray instead + of xmalloc. + * runtime/in_pack_generic.c (internal_pack): Likewise. + 2014-06-15 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR libfortran/60468 diff --git a/libgfortran/generated/all_l1.c b/libgfortran/generated/all_l1.c index ed956227cd7..0f008b97dcb 100644 --- a/libgfortran/generated/all_l1.c +++ b/libgfortran/generated/all_l1.c @@ -101,8 +101,7 @@ all_l1 (gfc_array_l1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ all_l1 (gfc_array_l1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1)); } else { diff --git a/libgfortran/generated/all_l16.c b/libgfortran/generated/all_l16.c index a23001b56ae..a9f85b4bfed 100644 --- a/libgfortran/generated/all_l16.c +++ b/libgfortran/generated/all_l16.c @@ -101,8 +101,7 @@ all_l16 (gfc_array_l16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ all_l16 (gfc_array_l16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16)); } else { diff --git a/libgfortran/generated/all_l2.c b/libgfortran/generated/all_l2.c index 28235d6dbf7..3ef4a1dc25c 100644 --- a/libgfortran/generated/all_l2.c +++ b/libgfortran/generated/all_l2.c @@ -101,8 +101,7 @@ all_l2 (gfc_array_l2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ all_l2 (gfc_array_l2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2)); } else { diff --git a/libgfortran/generated/all_l4.c b/libgfortran/generated/all_l4.c index 601b7c3970b..58dab4f124d 100644 --- a/libgfortran/generated/all_l4.c +++ b/libgfortran/generated/all_l4.c @@ -101,8 +101,7 @@ all_l4 (gfc_array_l4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ all_l4 (gfc_array_l4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4)); } else { diff --git a/libgfortran/generated/all_l8.c b/libgfortran/generated/all_l8.c index f0041dcdd37..4293aaa06b7 100644 --- a/libgfortran/generated/all_l8.c +++ b/libgfortran/generated/all_l8.c @@ -101,8 +101,7 @@ all_l8 (gfc_array_l8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ all_l8 (gfc_array_l8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8)); } else { diff --git a/libgfortran/generated/any_l1.c b/libgfortran/generated/any_l1.c index b94c8473527..46387fdd2a2 100644 --- a/libgfortran/generated/any_l1.c +++ b/libgfortran/generated/any_l1.c @@ -101,8 +101,7 @@ any_l1 (gfc_array_l1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ any_l1 (gfc_array_l1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1)); } else { diff --git a/libgfortran/generated/any_l16.c b/libgfortran/generated/any_l16.c index a821352670d..b29fdd923d7 100644 --- a/libgfortran/generated/any_l16.c +++ b/libgfortran/generated/any_l16.c @@ -101,8 +101,7 @@ any_l16 (gfc_array_l16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ any_l16 (gfc_array_l16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16)); } else { diff --git a/libgfortran/generated/any_l2.c b/libgfortran/generated/any_l2.c index 7f4eabc3623..a63c593d4b8 100644 --- a/libgfortran/generated/any_l2.c +++ b/libgfortran/generated/any_l2.c @@ -101,8 +101,7 @@ any_l2 (gfc_array_l2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ any_l2 (gfc_array_l2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2)); } else { diff --git a/libgfortran/generated/any_l4.c b/libgfortran/generated/any_l4.c index 8ec451a8f47..ccd35d78935 100644 --- a/libgfortran/generated/any_l4.c +++ b/libgfortran/generated/any_l4.c @@ -101,8 +101,7 @@ any_l4 (gfc_array_l4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ any_l4 (gfc_array_l4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4)); } else { diff --git a/libgfortran/generated/any_l8.c b/libgfortran/generated/any_l8.c index 47957a77d90..e089ea8beed 100644 --- a/libgfortran/generated/any_l8.c +++ b/libgfortran/generated/any_l8.c @@ -101,8 +101,7 @@ any_l8 (gfc_array_l8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ any_l8 (gfc_array_l8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8)); } else { diff --git a/libgfortran/generated/bessel_r10.c b/libgfortran/generated/bessel_r10.c index 980bf84261a..14b93e91007 100644 --- a/libgfortran/generated/bessel_r10.c +++ b/libgfortran/generated/bessel_r10.c @@ -55,7 +55,7 @@ bessel_jn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2, GFC_REAL_10 x { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10)); ret->offset = 0; } @@ -122,7 +122,7 @@ bessel_yn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2, { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10)); ret->offset = 0; } diff --git a/libgfortran/generated/bessel_r16.c b/libgfortran/generated/bessel_r16.c index d5757c9a60a..d64fa9c138e 100644 --- a/libgfortran/generated/bessel_r16.c +++ b/libgfortran/generated/bessel_r16.c @@ -59,7 +59,7 @@ bessel_jn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2, GFC_REAL_16 x { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_16)); ret->offset = 0; } @@ -126,7 +126,7 @@ bessel_yn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2, { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_16)); ret->offset = 0; } diff --git a/libgfortran/generated/bessel_r4.c b/libgfortran/generated/bessel_r4.c index 6b6129f01ec..a86bb5fa958 100644 --- a/libgfortran/generated/bessel_r4.c +++ b/libgfortran/generated/bessel_r4.c @@ -55,7 +55,7 @@ bessel_jn_r4 (gfc_array_r4 * const restrict ret, int n1, int n2, GFC_REAL_4 x) { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_4)); ret->offset = 0; } @@ -122,7 +122,7 @@ bessel_yn_r4 (gfc_array_r4 * const restrict ret, int n1, int n2, { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_4)); ret->offset = 0; } diff --git a/libgfortran/generated/bessel_r8.c b/libgfortran/generated/bessel_r8.c index a80a7662fdb..84018872e05 100644 --- a/libgfortran/generated/bessel_r8.c +++ b/libgfortran/generated/bessel_r8.c @@ -55,7 +55,7 @@ bessel_jn_r8 (gfc_array_r8 * const restrict ret, int n1, int n2, GFC_REAL_8 x) { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_8)); ret->offset = 0; } @@ -122,7 +122,7 @@ bessel_yn_r8 (gfc_array_r8 * const restrict ret, int n1, int n2, { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_8)); ret->offset = 0; } diff --git a/libgfortran/generated/count_16_l.c b/libgfortran/generated/count_16_l.c index f690236bc94..c6c0b5b9ceb 100644 --- a/libgfortran/generated/count_16_l.c +++ b/libgfortran/generated/count_16_l.c @@ -101,8 +101,7 @@ count_16_l (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ count_16_l (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/count_1_l.c b/libgfortran/generated/count_1_l.c index 359a2f9efb5..15d270d0443 100644 --- a/libgfortran/generated/count_1_l.c +++ b/libgfortran/generated/count_1_l.c @@ -101,8 +101,7 @@ count_1_l (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ count_1_l (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/count_2_l.c b/libgfortran/generated/count_2_l.c index 0dd51a178b8..fd9b3d37ab4 100644 --- a/libgfortran/generated/count_2_l.c +++ b/libgfortran/generated/count_2_l.c @@ -101,8 +101,7 @@ count_2_l (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ count_2_l (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/count_4_l.c b/libgfortran/generated/count_4_l.c index 7879ce84921..1e15256caa7 100644 --- a/libgfortran/generated/count_4_l.c +++ b/libgfortran/generated/count_4_l.c @@ -101,8 +101,7 @@ count_4_l (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ count_4_l (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/count_8_l.c b/libgfortran/generated/count_8_l.c index 21516f5ff94..97962a4fe2d 100644 --- a/libgfortran/generated/count_8_l.c +++ b/libgfortran/generated/count_8_l.c @@ -101,8 +101,7 @@ count_8_l (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ count_8_l (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/cshift1_16.c b/libgfortran/generated/cshift1_16.c index 77fc3bf36af..b0cc767aea7 100644 --- a/libgfortran/generated/cshift1_16.c +++ b/libgfortran/generated/cshift1_16.c @@ -80,7 +80,7 @@ cshift1 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) diff --git a/libgfortran/generated/cshift1_4.c b/libgfortran/generated/cshift1_4.c index 8accb4c8265..5ea8a6acedd 100644 --- a/libgfortran/generated/cshift1_4.c +++ b/libgfortran/generated/cshift1_4.c @@ -80,7 +80,7 @@ cshift1 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) diff --git a/libgfortran/generated/cshift1_8.c b/libgfortran/generated/cshift1_8.c index 6c809a99507..5c4dbc36048 100644 --- a/libgfortran/generated/cshift1_8.c +++ b/libgfortran/generated/cshift1_8.c @@ -80,7 +80,7 @@ cshift1 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) diff --git a/libgfortran/generated/eoshift1_16.c b/libgfortran/generated/eoshift1_16.c index 188589ff717..566d807b3a4 100644 --- a/libgfortran/generated/eoshift1_16.c +++ b/libgfortran/generated/eoshift1_16.c @@ -105,8 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/eoshift1_4.c b/libgfortran/generated/eoshift1_4.c index 81e85509820..bd5fabad311 100644 --- a/libgfortran/generated/eoshift1_4.c +++ b/libgfortran/generated/eoshift1_4.c @@ -105,8 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/eoshift1_8.c b/libgfortran/generated/eoshift1_8.c index eff6f766698..814f81a8149 100644 --- a/libgfortran/generated/eoshift1_8.c +++ b/libgfortran/generated/eoshift1_8.c @@ -105,8 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/eoshift3_16.c b/libgfortran/generated/eoshift3_16.c index fc5203d6e17..5e09df22eb5 100644 --- a/libgfortran/generated/eoshift3_16.c +++ b/libgfortran/generated/eoshift3_16.c @@ -89,7 +89,7 @@ eoshift3 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) @@ -107,8 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/eoshift3_4.c b/libgfortran/generated/eoshift3_4.c index ee2b568a4d7..970402c6341 100644 --- a/libgfortran/generated/eoshift3_4.c +++ b/libgfortran/generated/eoshift3_4.c @@ -89,7 +89,7 @@ eoshift3 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) @@ -107,8 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/eoshift3_8.c b/libgfortran/generated/eoshift3_8.c index b2e6d26cc34..991eb915164 100644 --- a/libgfortran/generated/eoshift3_8.c +++ b/libgfortran/generated/eoshift3_8.c @@ -89,7 +89,7 @@ eoshift3 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) @@ -107,8 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/iall_i1.c b/libgfortran/generated/iall_i1.c index ac36bac1369..da0ce4d22fb 100644 --- a/libgfortran/generated/iall_i1.c +++ b/libgfortran/generated/iall_i1.c @@ -97,10 +97,9 @@ iall_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miall_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miall_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -430,8 +428,7 @@ siall_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siall_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/iall_i16.c b/libgfortran/generated/iall_i16.c index de333617a57..a3f39d3c976 100644 --- a/libgfortran/generated/iall_i16.c +++ b/libgfortran/generated/iall_i16.c @@ -97,10 +97,9 @@ iall_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miall_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miall_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -430,8 +428,7 @@ siall_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siall_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/iall_i2.c b/libgfortran/generated/iall_i2.c index a347036869e..4ca06a8a012 100644 --- a/libgfortran/generated/iall_i2.c +++ b/libgfortran/generated/iall_i2.c @@ -97,10 +97,9 @@ iall_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miall_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miall_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -430,8 +428,7 @@ siall_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siall_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/iall_i4.c b/libgfortran/generated/iall_i4.c index 55e09b87638..8ff15f4ed4a 100644 --- a/libgfortran/generated/iall_i4.c +++ b/libgfortran/generated/iall_i4.c @@ -97,10 +97,9 @@ iall_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miall_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miall_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -430,8 +428,7 @@ siall_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siall_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/iall_i8.c b/libgfortran/generated/iall_i8.c index 9c7f88d216c..08932d4862d 100644 --- a/libgfortran/generated/iall_i8.c +++ b/libgfortran/generated/iall_i8.c @@ -97,10 +97,9 @@ iall_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miall_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miall_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -430,8 +428,7 @@ siall_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siall_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/iany_i1.c b/libgfortran/generated/iany_i1.c index 2ce620b6970..999230a114c 100644 --- a/libgfortran/generated/iany_i1.c +++ b/libgfortran/generated/iany_i1.c @@ -97,10 +97,9 @@ iany_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miany_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miany_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -430,8 +428,7 @@ siany_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siany_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/iany_i16.c b/libgfortran/generated/iany_i16.c index 38e28d1b8ad..9410db45c33 100644 --- a/libgfortran/generated/iany_i16.c +++ b/libgfortran/generated/iany_i16.c @@ -97,10 +97,9 @@ iany_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miany_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miany_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -430,8 +428,7 @@ siany_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siany_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/iany_i2.c b/libgfortran/generated/iany_i2.c index 7a4b79c9315..7068bb192e2 100644 --- a/libgfortran/generated/iany_i2.c +++ b/libgfortran/generated/iany_i2.c @@ -97,10 +97,9 @@ iany_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miany_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miany_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -430,8 +428,7 @@ siany_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siany_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/iany_i4.c b/libgfortran/generated/iany_i4.c index 126c2fa6277..62034cfd832 100644 --- a/libgfortran/generated/iany_i4.c +++ b/libgfortran/generated/iany_i4.c @@ -97,10 +97,9 @@ iany_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miany_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miany_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -430,8 +428,7 @@ siany_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siany_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/iany_i8.c b/libgfortran/generated/iany_i8.c index ee2a07f9ca9..f347d69f1dd 100644 --- a/libgfortran/generated/iany_i8.c +++ b/libgfortran/generated/iany_i8.c @@ -97,10 +97,9 @@ iany_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miany_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miany_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -430,8 +428,7 @@ siany_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siany_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/in_pack_c10.c b/libgfortran/generated/in_pack_c10.c index ff3bb332e65..9148af57712 100644 --- a/libgfortran/generated/in_pack_c10.c +++ b/libgfortran/generated/in_pack_c10.c @@ -76,7 +76,7 @@ internal_pack_c10 (gfc_array_c10 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_COMPLEX_10 *)xmalloc (ssize * sizeof (GFC_COMPLEX_10)); + destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_10)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_c16.c b/libgfortran/generated/in_pack_c16.c index a3e96124750..e109efc1d5d 100644 --- a/libgfortran/generated/in_pack_c16.c +++ b/libgfortran/generated/in_pack_c16.c @@ -76,7 +76,7 @@ internal_pack_c16 (gfc_array_c16 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_COMPLEX_16 *)xmalloc (ssize * sizeof (GFC_COMPLEX_16)); + destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_16)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_c4.c b/libgfortran/generated/in_pack_c4.c index 2959354a851..3afdaf3a44e 100644 --- a/libgfortran/generated/in_pack_c4.c +++ b/libgfortran/generated/in_pack_c4.c @@ -76,7 +76,7 @@ internal_pack_c4 (gfc_array_c4 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_COMPLEX_4 *)xmalloc (ssize * sizeof (GFC_COMPLEX_4)); + destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_4)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_c8.c b/libgfortran/generated/in_pack_c8.c index e63ea9d2996..995a3676dc7 100644 --- a/libgfortran/generated/in_pack_c8.c +++ b/libgfortran/generated/in_pack_c8.c @@ -76,7 +76,7 @@ internal_pack_c8 (gfc_array_c8 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_COMPLEX_8 *)xmalloc (ssize * sizeof (GFC_COMPLEX_8)); + destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_8)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_i1.c b/libgfortran/generated/in_pack_i1.c index 2356102e3fb..2ee5e283747 100644 --- a/libgfortran/generated/in_pack_i1.c +++ b/libgfortran/generated/in_pack_i1.c @@ -76,7 +76,7 @@ internal_pack_1 (gfc_array_i1 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_INTEGER_1 *)xmalloc (ssize * sizeof (GFC_INTEGER_1)); + destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_1)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_i16.c b/libgfortran/generated/in_pack_i16.c index e271a896ac9..ac6bb4f8ab1 100644 --- a/libgfortran/generated/in_pack_i16.c +++ b/libgfortran/generated/in_pack_i16.c @@ -76,7 +76,7 @@ internal_pack_16 (gfc_array_i16 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_INTEGER_16 *)xmalloc (ssize * sizeof (GFC_INTEGER_16)); + destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_16)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_i2.c b/libgfortran/generated/in_pack_i2.c index 391e27d2485..f42a89254ad 100644 --- a/libgfortran/generated/in_pack_i2.c +++ b/libgfortran/generated/in_pack_i2.c @@ -76,7 +76,7 @@ internal_pack_2 (gfc_array_i2 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_INTEGER_2 *)xmalloc (ssize * sizeof (GFC_INTEGER_2)); + destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_2)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_i4.c b/libgfortran/generated/in_pack_i4.c index 6ba02774325..acde25aa9e3 100644 --- a/libgfortran/generated/in_pack_i4.c +++ b/libgfortran/generated/in_pack_i4.c @@ -76,7 +76,7 @@ internal_pack_4 (gfc_array_i4 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_INTEGER_4 *)xmalloc (ssize * sizeof (GFC_INTEGER_4)); + destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_4)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_i8.c b/libgfortran/generated/in_pack_i8.c index 4c05043b735..5be35445c20 100644 --- a/libgfortran/generated/in_pack_i8.c +++ b/libgfortran/generated/in_pack_i8.c @@ -76,7 +76,7 @@ internal_pack_8 (gfc_array_i8 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_INTEGER_8 *)xmalloc (ssize * sizeof (GFC_INTEGER_8)); + destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_8)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_r10.c b/libgfortran/generated/in_pack_r10.c index 75dec30ed90..c4680d8cc92 100644 --- a/libgfortran/generated/in_pack_r10.c +++ b/libgfortran/generated/in_pack_r10.c @@ -76,7 +76,7 @@ internal_pack_r10 (gfc_array_r10 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_REAL_10 *)xmalloc (ssize * sizeof (GFC_REAL_10)); + destptr = xmallocarray (ssize, sizeof (GFC_REAL_10)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_r16.c b/libgfortran/generated/in_pack_r16.c index a37623a3bd6..ff09d1462f2 100644 --- a/libgfortran/generated/in_pack_r16.c +++ b/libgfortran/generated/in_pack_r16.c @@ -76,7 +76,7 @@ internal_pack_r16 (gfc_array_r16 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_REAL_16 *)xmalloc (ssize * sizeof (GFC_REAL_16)); + destptr = xmallocarray (ssize, sizeof (GFC_REAL_16)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_r4.c b/libgfortran/generated/in_pack_r4.c index 5a28ff07cda..34fe5829aed 100644 --- a/libgfortran/generated/in_pack_r4.c +++ b/libgfortran/generated/in_pack_r4.c @@ -76,7 +76,7 @@ internal_pack_r4 (gfc_array_r4 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_REAL_4 *)xmalloc (ssize * sizeof (GFC_REAL_4)); + destptr = xmallocarray (ssize, sizeof (GFC_REAL_4)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/in_pack_r8.c b/libgfortran/generated/in_pack_r8.c index 7c4fa428bd6..b0728c9b69f 100644 --- a/libgfortran/generated/in_pack_r8.c +++ b/libgfortran/generated/in_pack_r8.c @@ -76,7 +76,7 @@ internal_pack_r8 (gfc_array_r8 * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = (GFC_REAL_8 *)xmalloc (ssize * sizeof (GFC_REAL_8)); + destptr = xmallocarray (ssize, sizeof (GFC_REAL_8)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/generated/iparity_i1.c b/libgfortran/generated/iparity_i1.c index 9ccbd55ded6..fdccc3d4433 100644 --- a/libgfortran/generated/iparity_i1.c +++ b/libgfortran/generated/iparity_i1.c @@ -97,10 +97,9 @@ iparity_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miparity_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miparity_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -430,8 +428,7 @@ siparity_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siparity_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/iparity_i16.c b/libgfortran/generated/iparity_i16.c index 6a4d03277ae..7a572ba7130 100644 --- a/libgfortran/generated/iparity_i16.c +++ b/libgfortran/generated/iparity_i16.c @@ -97,10 +97,9 @@ iparity_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miparity_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miparity_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -430,8 +428,7 @@ siparity_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siparity_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/iparity_i2.c b/libgfortran/generated/iparity_i2.c index cb0d8a91b29..49233fbc56d 100644 --- a/libgfortran/generated/iparity_i2.c +++ b/libgfortran/generated/iparity_i2.c @@ -97,10 +97,9 @@ iparity_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miparity_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miparity_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -430,8 +428,7 @@ siparity_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siparity_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/iparity_i4.c b/libgfortran/generated/iparity_i4.c index 689f0c125b4..1551e51febe 100644 --- a/libgfortran/generated/iparity_i4.c +++ b/libgfortran/generated/iparity_i4.c @@ -97,10 +97,9 @@ iparity_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miparity_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miparity_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -430,8 +428,7 @@ siparity_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siparity_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/iparity_i8.c b/libgfortran/generated/iparity_i8.c index de84f561aee..a745bb6bec6 100644 --- a/libgfortran/generated/iparity_i8.c +++ b/libgfortran/generated/iparity_i8.c @@ -97,10 +97,9 @@ iparity_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miparity_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miparity_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -430,8 +428,7 @@ siparity_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siparity_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c index 53a8c6a9f43..0ff7d58b9a5 100644 --- a/libgfortran/generated/matmul_c10.c +++ b/libgfortran/generated/matmul_c10.c @@ -124,7 +124,7 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_10)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c index 00ddc1347ec..a5fea00c8da 100644 --- a/libgfortran/generated/matmul_c16.c +++ b/libgfortran/generated/matmul_c16.c @@ -124,7 +124,7 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_16)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c index cdb92c43ddc..b5b0ecb83ec 100644 --- a/libgfortran/generated/matmul_c4.c +++ b/libgfortran/generated/matmul_c4.c @@ -124,7 +124,7 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_4)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c index 6a223d04f54..077b709df98 100644 --- a/libgfortran/generated/matmul_c8.c +++ b/libgfortran/generated/matmul_c8.c @@ -124,7 +124,7 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_8)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_i1.c b/libgfortran/generated/matmul_i1.c index bc24f1179be..72c998a1b47 100644 --- a/libgfortran/generated/matmul_i1.c +++ b/libgfortran/generated/matmul_i1.c @@ -124,7 +124,7 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_INTEGER_1) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_1)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c index 74fe262217a..59cd80ba8d0 100644 --- a/libgfortran/generated/matmul_i16.c +++ b/libgfortran/generated/matmul_i16.c @@ -124,7 +124,7 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_INTEGER_16) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_16)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_i2.c b/libgfortran/generated/matmul_i2.c index 8627361bae8..6fddc4f18e2 100644 --- a/libgfortran/generated/matmul_i2.c +++ b/libgfortran/generated/matmul_i2.c @@ -124,7 +124,7 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_INTEGER_2) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_2)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c index 37e5d5b1d43..f62cb56aa1b 100644 --- a/libgfortran/generated/matmul_i4.c +++ b/libgfortran/generated/matmul_i4.c @@ -124,7 +124,7 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_INTEGER_4) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_4)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c index 892822ae147..6d524905ea5 100644 --- a/libgfortran/generated/matmul_i8.c +++ b/libgfortran/generated/matmul_i8.c @@ -124,7 +124,7 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_INTEGER_8) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_8)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_l16.c b/libgfortran/generated/matmul_l16.c index bc600300966..370db0731cf 100644 --- a/libgfortran/generated/matmul_l16.c +++ b/libgfortran/generated/matmul_l16.c @@ -88,7 +88,7 @@ matmul_l16 (gfc_array_l16 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_LOGICAL_16) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_16)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_l4.c b/libgfortran/generated/matmul_l4.c index d464e620605..d901e3cd7d8 100644 --- a/libgfortran/generated/matmul_l4.c +++ b/libgfortran/generated/matmul_l4.c @@ -88,7 +88,7 @@ matmul_l4 (gfc_array_l4 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_LOGICAL_4) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_4)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_l8.c b/libgfortran/generated/matmul_l8.c index 0fd6bad019d..5862c8d870c 100644 --- a/libgfortran/generated/matmul_l8.c +++ b/libgfortran/generated/matmul_l8.c @@ -88,7 +88,7 @@ matmul_l8 (gfc_array_l8 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_LOGICAL_8) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_8)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c index e222044703b..6c9656adfda 100644 --- a/libgfortran/generated/matmul_r10.c +++ b/libgfortran/generated/matmul_r10.c @@ -124,7 +124,7 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_REAL_10) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_10)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c index 335feb07469..fbe8e092884 100644 --- a/libgfortran/generated/matmul_r16.c +++ b/libgfortran/generated/matmul_r16.c @@ -124,7 +124,7 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_REAL_16) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_16)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c index bb07efa0ca0..f80c8bfcd2f 100644 --- a/libgfortran/generated/matmul_r4.c +++ b/libgfortran/generated/matmul_r4.c @@ -124,7 +124,7 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_REAL_4) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_4)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c index a3bc842a798..7aec3b3c2af 100644 --- a/libgfortran/generated/matmul_r8.c +++ b/libgfortran/generated/matmul_r8.c @@ -124,7 +124,7 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_REAL_8) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_8)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/maxloc0_16_i1.c b/libgfortran/generated/maxloc0_16_i1.c index 01d6e77cca8..d205d24667c 100644 --- a/libgfortran/generated/maxloc0_16_i1.c +++ b/libgfortran/generated/maxloc0_16_i1.c @@ -58,7 +58,7 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_i16.c b/libgfortran/generated/maxloc0_16_i16.c index c24b4be04ce..3d8e3dc0fd7 100644 --- a/libgfortran/generated/maxloc0_16_i16.c +++ b/libgfortran/generated/maxloc0_16_i16.c @@ -58,7 +58,7 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_i2.c b/libgfortran/generated/maxloc0_16_i2.c index 1a0f2b64b0d..93f5cc47732 100644 --- a/libgfortran/generated/maxloc0_16_i2.c +++ b/libgfortran/generated/maxloc0_16_i2.c @@ -58,7 +58,7 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_i4.c b/libgfortran/generated/maxloc0_16_i4.c index 005a96336fe..6858c8ff7fd 100644 --- a/libgfortran/generated/maxloc0_16_i4.c +++ b/libgfortran/generated/maxloc0_16_i4.c @@ -58,7 +58,7 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_i8.c b/libgfortran/generated/maxloc0_16_i8.c index 2643b82ddbe..f324b02fc3a 100644 --- a/libgfortran/generated/maxloc0_16_i8.c +++ b/libgfortran/generated/maxloc0_16_i8.c @@ -58,7 +58,7 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_r10.c b/libgfortran/generated/maxloc0_16_r10.c index 714a5234341..03560f711f0 100644 --- a/libgfortran/generated/maxloc0_16_r10.c +++ b/libgfortran/generated/maxloc0_16_r10.c @@ -58,7 +58,7 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_r16.c b/libgfortran/generated/maxloc0_16_r16.c index 5a2ecb3044e..aeb2e81d2c8 100644 --- a/libgfortran/generated/maxloc0_16_r16.c +++ b/libgfortran/generated/maxloc0_16_r16.c @@ -58,7 +58,7 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_r4.c b/libgfortran/generated/maxloc0_16_r4.c index 5556429fba6..a88774e954b 100644 --- a/libgfortran/generated/maxloc0_16_r4.c +++ b/libgfortran/generated/maxloc0_16_r4.c @@ -58,7 +58,7 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_r8.c b/libgfortran/generated/maxloc0_16_r8.c index 2ae92c9fce6..8704cad65cb 100644 --- a/libgfortran/generated/maxloc0_16_r8.c +++ b/libgfortran/generated/maxloc0_16_r8.c @@ -58,7 +58,7 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_i1.c b/libgfortran/generated/maxloc0_4_i1.c index 2470b4907c8..8e75ec977af 100644 --- a/libgfortran/generated/maxloc0_4_i1.c +++ b/libgfortran/generated/maxloc0_4_i1.c @@ -58,7 +58,7 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_i16.c b/libgfortran/generated/maxloc0_4_i16.c index 850a26cfa72..67383b6c5b0 100644 --- a/libgfortran/generated/maxloc0_4_i16.c +++ b/libgfortran/generated/maxloc0_4_i16.c @@ -58,7 +58,7 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_i2.c b/libgfortran/generated/maxloc0_4_i2.c index 89715197f46..3991bd6b240 100644 --- a/libgfortran/generated/maxloc0_4_i2.c +++ b/libgfortran/generated/maxloc0_4_i2.c @@ -58,7 +58,7 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_i4.c b/libgfortran/generated/maxloc0_4_i4.c index 9ad21d74558..0a714c3c182 100644 --- a/libgfortran/generated/maxloc0_4_i4.c +++ b/libgfortran/generated/maxloc0_4_i4.c @@ -58,7 +58,7 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_i8.c b/libgfortran/generated/maxloc0_4_i8.c index 7e1e3a46be1..c32c6fb4f9f 100644 --- a/libgfortran/generated/maxloc0_4_i8.c +++ b/libgfortran/generated/maxloc0_4_i8.c @@ -58,7 +58,7 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_r10.c b/libgfortran/generated/maxloc0_4_r10.c index 4d1d980ff40..d2d7f2ef7f1 100644 --- a/libgfortran/generated/maxloc0_4_r10.c +++ b/libgfortran/generated/maxloc0_4_r10.c @@ -58,7 +58,7 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_r16.c b/libgfortran/generated/maxloc0_4_r16.c index 0d37cdada0d..e9d8620f0a5 100644 --- a/libgfortran/generated/maxloc0_4_r16.c +++ b/libgfortran/generated/maxloc0_4_r16.c @@ -58,7 +58,7 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_r4.c b/libgfortran/generated/maxloc0_4_r4.c index 6db50f803ff..c402868def7 100644 --- a/libgfortran/generated/maxloc0_4_r4.c +++ b/libgfortran/generated/maxloc0_4_r4.c @@ -58,7 +58,7 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_r8.c b/libgfortran/generated/maxloc0_4_r8.c index 610f757f415..5057e9c34a7 100644 --- a/libgfortran/generated/maxloc0_4_r8.c +++ b/libgfortran/generated/maxloc0_4_r8.c @@ -58,7 +58,7 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_i1.c b/libgfortran/generated/maxloc0_8_i1.c index 6e1d0495978..95d027dbd32 100644 --- a/libgfortran/generated/maxloc0_8_i1.c +++ b/libgfortran/generated/maxloc0_8_i1.c @@ -58,7 +58,7 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_i16.c b/libgfortran/generated/maxloc0_8_i16.c index aa2d6e39d7b..1fa391b1165 100644 --- a/libgfortran/generated/maxloc0_8_i16.c +++ b/libgfortran/generated/maxloc0_8_i16.c @@ -58,7 +58,7 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_i2.c b/libgfortran/generated/maxloc0_8_i2.c index b9fd82b4c10..d98a1a25adf 100644 --- a/libgfortran/generated/maxloc0_8_i2.c +++ b/libgfortran/generated/maxloc0_8_i2.c @@ -58,7 +58,7 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_i4.c b/libgfortran/generated/maxloc0_8_i4.c index 36bba3e5fc6..56a77487fa0 100644 --- a/libgfortran/generated/maxloc0_8_i4.c +++ b/libgfortran/generated/maxloc0_8_i4.c @@ -58,7 +58,7 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_i8.c b/libgfortran/generated/maxloc0_8_i8.c index e8089283cfe..dd1fe2c56f4 100644 --- a/libgfortran/generated/maxloc0_8_i8.c +++ b/libgfortran/generated/maxloc0_8_i8.c @@ -58,7 +58,7 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_r10.c b/libgfortran/generated/maxloc0_8_r10.c index fba75b9878d..2c8394cefa6 100644 --- a/libgfortran/generated/maxloc0_8_r10.c +++ b/libgfortran/generated/maxloc0_8_r10.c @@ -58,7 +58,7 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_r16.c b/libgfortran/generated/maxloc0_8_r16.c index 24e317ea2ce..4ebf6f4738b 100644 --- a/libgfortran/generated/maxloc0_8_r16.c +++ b/libgfortran/generated/maxloc0_8_r16.c @@ -58,7 +58,7 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_r4.c b/libgfortran/generated/maxloc0_8_r4.c index 88dc2b23080..893adadd7fd 100644 --- a/libgfortran/generated/maxloc0_8_r4.c +++ b/libgfortran/generated/maxloc0_8_r4.c @@ -58,7 +58,7 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_r8.c b/libgfortran/generated/maxloc0_8_r8.c index 23c1115bfa9..e2343430a2e 100644 --- a/libgfortran/generated/maxloc0_8_r8.c +++ b/libgfortran/generated/maxloc0_8_r8.c @@ -58,7 +58,7 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc1_16_i1.c b/libgfortran/generated/maxloc1_16_i1.c index 0602fc9ef13..4d1bea09c7c 100644 --- a/libgfortran/generated/maxloc1_16_i1.c +++ b/libgfortran/generated/maxloc1_16_i1.c @@ -98,10 +98,9 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_i16.c b/libgfortran/generated/maxloc1_16_i16.c index 3f8c517246b..eb9b2a0cd62 100644 --- a/libgfortran/generated/maxloc1_16_i16.c +++ b/libgfortran/generated/maxloc1_16_i16.c @@ -98,10 +98,9 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_i2.c b/libgfortran/generated/maxloc1_16_i2.c index f2842106542..91a0800a7ba 100644 --- a/libgfortran/generated/maxloc1_16_i2.c +++ b/libgfortran/generated/maxloc1_16_i2.c @@ -98,10 +98,9 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_i4.c b/libgfortran/generated/maxloc1_16_i4.c index 35fcc2a25f1..c680351674d 100644 --- a/libgfortran/generated/maxloc1_16_i4.c +++ b/libgfortran/generated/maxloc1_16_i4.c @@ -98,10 +98,9 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_i8.c b/libgfortran/generated/maxloc1_16_i8.c index b2c945c0be6..ea164dc6b3a 100644 --- a/libgfortran/generated/maxloc1_16_i8.c +++ b/libgfortran/generated/maxloc1_16_i8.c @@ -98,10 +98,9 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_r10.c b/libgfortran/generated/maxloc1_16_r10.c index d898dde1437..4d5ed45a5f4 100644 --- a/libgfortran/generated/maxloc1_16_r10.c +++ b/libgfortran/generated/maxloc1_16_r10.c @@ -98,10 +98,9 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_r16.c b/libgfortran/generated/maxloc1_16_r16.c index 28e2db48fef..572d91617a1 100644 --- a/libgfortran/generated/maxloc1_16_r16.c +++ b/libgfortran/generated/maxloc1_16_r16.c @@ -98,10 +98,9 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_r4.c b/libgfortran/generated/maxloc1_16_r4.c index f7f85a7d9ce..d9aef3e63b8 100644 --- a/libgfortran/generated/maxloc1_16_r4.c +++ b/libgfortran/generated/maxloc1_16_r4.c @@ -98,10 +98,9 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_r8.c b/libgfortran/generated/maxloc1_16_r8.c index 69c82d3736d..d1014cdb07d 100644 --- a/libgfortran/generated/maxloc1_16_r8.c +++ b/libgfortran/generated/maxloc1_16_r8.c @@ -98,10 +98,9 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_4_i1.c b/libgfortran/generated/maxloc1_4_i1.c index fde19475693..1ab44ab6b0e 100644 --- a/libgfortran/generated/maxloc1_4_i1.c +++ b/libgfortran/generated/maxloc1_4_i1.c @@ -98,10 +98,9 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_i16.c b/libgfortran/generated/maxloc1_4_i16.c index c7b32b3e4ab..59bb2a31e39 100644 --- a/libgfortran/generated/maxloc1_4_i16.c +++ b/libgfortran/generated/maxloc1_4_i16.c @@ -98,10 +98,9 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_i2.c b/libgfortran/generated/maxloc1_4_i2.c index 2a16a0b795c..794fde04d12 100644 --- a/libgfortran/generated/maxloc1_4_i2.c +++ b/libgfortran/generated/maxloc1_4_i2.c @@ -98,10 +98,9 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_i4.c b/libgfortran/generated/maxloc1_4_i4.c index 7c693e114b3..d10e937365a 100644 --- a/libgfortran/generated/maxloc1_4_i4.c +++ b/libgfortran/generated/maxloc1_4_i4.c @@ -98,10 +98,9 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_i8.c b/libgfortran/generated/maxloc1_4_i8.c index 45188e1d08a..b761b8264e1 100644 --- a/libgfortran/generated/maxloc1_4_i8.c +++ b/libgfortran/generated/maxloc1_4_i8.c @@ -98,10 +98,9 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_r10.c b/libgfortran/generated/maxloc1_4_r10.c index bd0e0f862af..f1d522df5cf 100644 --- a/libgfortran/generated/maxloc1_4_r10.c +++ b/libgfortran/generated/maxloc1_4_r10.c @@ -98,10 +98,9 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_r16.c b/libgfortran/generated/maxloc1_4_r16.c index 37428b29562..deaf571ba89 100644 --- a/libgfortran/generated/maxloc1_4_r16.c +++ b/libgfortran/generated/maxloc1_4_r16.c @@ -98,10 +98,9 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_r4.c b/libgfortran/generated/maxloc1_4_r4.c index a42c7b4471c..bc644959958 100644 --- a/libgfortran/generated/maxloc1_4_r4.c +++ b/libgfortran/generated/maxloc1_4_r4.c @@ -98,10 +98,9 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c index 85b79653982..af09cb3ecec 100644 --- a/libgfortran/generated/maxloc1_4_r8.c +++ b/libgfortran/generated/maxloc1_4_r8.c @@ -98,10 +98,9 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_8_i1.c b/libgfortran/generated/maxloc1_8_i1.c index 4c5d55ef154..caaabe72d40 100644 --- a/libgfortran/generated/maxloc1_8_i1.c +++ b/libgfortran/generated/maxloc1_8_i1.c @@ -98,10 +98,9 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_i16.c b/libgfortran/generated/maxloc1_8_i16.c index 6779d6a7b19..384635c99e0 100644 --- a/libgfortran/generated/maxloc1_8_i16.c +++ b/libgfortran/generated/maxloc1_8_i16.c @@ -98,10 +98,9 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_i2.c b/libgfortran/generated/maxloc1_8_i2.c index 2fe5696371d..731c7237e17 100644 --- a/libgfortran/generated/maxloc1_8_i2.c +++ b/libgfortran/generated/maxloc1_8_i2.c @@ -98,10 +98,9 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_i4.c b/libgfortran/generated/maxloc1_8_i4.c index ae06e9e6e00..26fdf834bb3 100644 --- a/libgfortran/generated/maxloc1_8_i4.c +++ b/libgfortran/generated/maxloc1_8_i4.c @@ -98,10 +98,9 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_i8.c b/libgfortran/generated/maxloc1_8_i8.c index d8d7b6836b4..a7f43d15f3e 100644 --- a/libgfortran/generated/maxloc1_8_i8.c +++ b/libgfortran/generated/maxloc1_8_i8.c @@ -98,10 +98,9 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_r10.c b/libgfortran/generated/maxloc1_8_r10.c index 2b44cbb7b9f..f996db49589 100644 --- a/libgfortran/generated/maxloc1_8_r10.c +++ b/libgfortran/generated/maxloc1_8_r10.c @@ -98,10 +98,9 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_r16.c b/libgfortran/generated/maxloc1_8_r16.c index bcee8016806..d3ae5cb36bd 100644 --- a/libgfortran/generated/maxloc1_8_r16.c +++ b/libgfortran/generated/maxloc1_8_r16.c @@ -98,10 +98,9 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_r4.c b/libgfortran/generated/maxloc1_8_r4.c index 57a039d3642..c282cf7035d 100644 --- a/libgfortran/generated/maxloc1_8_r4.c +++ b/libgfortran/generated/maxloc1_8_r4.c @@ -98,10 +98,9 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c index c1136809811..13446e0708b 100644 --- a/libgfortran/generated/maxloc1_8_r8.c +++ b/libgfortran/generated/maxloc1_8_r8.c @@ -98,10 +98,9 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxval_i1.c b/libgfortran/generated/maxval_i1.c index 18d4eff3e18..eadec5ce9fd 100644 --- a/libgfortran/generated/maxval_i1.c +++ b/libgfortran/generated/maxval_i1.c @@ -97,10 +97,9 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -472,8 +470,7 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/maxval_i16.c b/libgfortran/generated/maxval_i16.c index 6815eb2a7fe..b83dd181e76 100644 --- a/libgfortran/generated/maxval_i16.c +++ b/libgfortran/generated/maxval_i16.c @@ -97,10 +97,9 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -472,8 +470,7 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxval_i2.c b/libgfortran/generated/maxval_i2.c index 5b99b3422dd..72bb3b4dda0 100644 --- a/libgfortran/generated/maxval_i2.c +++ b/libgfortran/generated/maxval_i2.c @@ -97,10 +97,9 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -472,8 +470,7 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/maxval_i4.c b/libgfortran/generated/maxval_i4.c index ff19f9cd3b5..c939a0acd43 100644 --- a/libgfortran/generated/maxval_i4.c +++ b/libgfortran/generated/maxval_i4.c @@ -97,10 +97,9 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -472,8 +470,7 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c index d708c3478c0..50ee398d289 100644 --- a/libgfortran/generated/maxval_i8.c +++ b/libgfortran/generated/maxval_i8.c @@ -97,10 +97,9 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -472,8 +470,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxval_r10.c b/libgfortran/generated/maxval_r10.c index 759198ba78f..b16d2634159 100644 --- a/libgfortran/generated/maxval_r10.c +++ b/libgfortran/generated/maxval_r10.c @@ -97,10 +97,9 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else @@ -472,8 +470,7 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else { diff --git a/libgfortran/generated/maxval_r16.c b/libgfortran/generated/maxval_r16.c index b16c4cb3b11..df6f2b088e9 100644 --- a/libgfortran/generated/maxval_r16.c +++ b/libgfortran/generated/maxval_r16.c @@ -97,10 +97,9 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else @@ -472,8 +470,7 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else { diff --git a/libgfortran/generated/maxval_r4.c b/libgfortran/generated/maxval_r4.c index db688855b48..edccaeb6567 100644 --- a/libgfortran/generated/maxval_r4.c +++ b/libgfortran/generated/maxval_r4.c @@ -97,10 +97,9 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else @@ -472,8 +470,7 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else { diff --git a/libgfortran/generated/maxval_r8.c b/libgfortran/generated/maxval_r8.c index ea0c8d8493d..bfbfa981dde 100644 --- a/libgfortran/generated/maxval_r8.c +++ b/libgfortran/generated/maxval_r8.c @@ -97,10 +97,9 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else @@ -472,8 +470,7 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else { diff --git a/libgfortran/generated/minloc0_16_i1.c b/libgfortran/generated/minloc0_16_i1.c index f70d9fff4eb..ccd89f043a4 100644 --- a/libgfortran/generated/minloc0_16_i1.c +++ b/libgfortran/generated/minloc0_16_i1.c @@ -58,7 +58,7 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_i16.c b/libgfortran/generated/minloc0_16_i16.c index 7962415924c..65050b9843c 100644 --- a/libgfortran/generated/minloc0_16_i16.c +++ b/libgfortran/generated/minloc0_16_i16.c @@ -58,7 +58,7 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_i2.c b/libgfortran/generated/minloc0_16_i2.c index e06f9f9c664..9fb63255e3a 100644 --- a/libgfortran/generated/minloc0_16_i2.c +++ b/libgfortran/generated/minloc0_16_i2.c @@ -58,7 +58,7 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_i4.c b/libgfortran/generated/minloc0_16_i4.c index 099ac7e05cb..999ac4b50c6 100644 --- a/libgfortran/generated/minloc0_16_i4.c +++ b/libgfortran/generated/minloc0_16_i4.c @@ -58,7 +58,7 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_i8.c b/libgfortran/generated/minloc0_16_i8.c index 2361c859675..3c2e3c3a9b3 100644 --- a/libgfortran/generated/minloc0_16_i8.c +++ b/libgfortran/generated/minloc0_16_i8.c @@ -58,7 +58,7 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_r10.c b/libgfortran/generated/minloc0_16_r10.c index 9777ed15cdb..c661cdc0f6c 100644 --- a/libgfortran/generated/minloc0_16_r10.c +++ b/libgfortran/generated/minloc0_16_r10.c @@ -58,7 +58,7 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_r16.c b/libgfortran/generated/minloc0_16_r16.c index 6d3a3498201..c455e92de7f 100644 --- a/libgfortran/generated/minloc0_16_r16.c +++ b/libgfortran/generated/minloc0_16_r16.c @@ -58,7 +58,7 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_r4.c b/libgfortran/generated/minloc0_16_r4.c index 6db57e84144..779935e4ffe 100644 --- a/libgfortran/generated/minloc0_16_r4.c +++ b/libgfortran/generated/minloc0_16_r4.c @@ -58,7 +58,7 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_r8.c b/libgfortran/generated/minloc0_16_r8.c index 41e94b4278e..d9023767772 100644 --- a/libgfortran/generated/minloc0_16_r8.c +++ b/libgfortran/generated/minloc0_16_r8.c @@ -58,7 +58,7 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_i1.c b/libgfortran/generated/minloc0_4_i1.c index a2acfa9a537..a9e902dd365 100644 --- a/libgfortran/generated/minloc0_4_i1.c +++ b/libgfortran/generated/minloc0_4_i1.c @@ -58,7 +58,7 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_i16.c b/libgfortran/generated/minloc0_4_i16.c index 92052541955..7981c28ba00 100644 --- a/libgfortran/generated/minloc0_4_i16.c +++ b/libgfortran/generated/minloc0_4_i16.c @@ -58,7 +58,7 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_i2.c b/libgfortran/generated/minloc0_4_i2.c index 087e9245e08..59439faa092 100644 --- a/libgfortran/generated/minloc0_4_i2.c +++ b/libgfortran/generated/minloc0_4_i2.c @@ -58,7 +58,7 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_i4.c b/libgfortran/generated/minloc0_4_i4.c index e8d43a818c9..5731a43ea77 100644 --- a/libgfortran/generated/minloc0_4_i4.c +++ b/libgfortran/generated/minloc0_4_i4.c @@ -58,7 +58,7 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_i8.c b/libgfortran/generated/minloc0_4_i8.c index d2c81e7611c..50b8e1612e3 100644 --- a/libgfortran/generated/minloc0_4_i8.c +++ b/libgfortran/generated/minloc0_4_i8.c @@ -58,7 +58,7 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_r10.c b/libgfortran/generated/minloc0_4_r10.c index 25c7c5a75ce..2701a859f54 100644 --- a/libgfortran/generated/minloc0_4_r10.c +++ b/libgfortran/generated/minloc0_4_r10.c @@ -58,7 +58,7 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_r16.c b/libgfortran/generated/minloc0_4_r16.c index c41a9f39c0e..fca50b39ea9 100644 --- a/libgfortran/generated/minloc0_4_r16.c +++ b/libgfortran/generated/minloc0_4_r16.c @@ -58,7 +58,7 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_r4.c b/libgfortran/generated/minloc0_4_r4.c index 08f733fa37d..0469a5280d0 100644 --- a/libgfortran/generated/minloc0_4_r4.c +++ b/libgfortran/generated/minloc0_4_r4.c @@ -58,7 +58,7 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_r8.c b/libgfortran/generated/minloc0_4_r8.c index 590138f1bc6..7be43c4af24 100644 --- a/libgfortran/generated/minloc0_4_r8.c +++ b/libgfortran/generated/minloc0_4_r8.c @@ -58,7 +58,7 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_i1.c b/libgfortran/generated/minloc0_8_i1.c index 2bce3945319..60bfe811cdc 100644 --- a/libgfortran/generated/minloc0_8_i1.c +++ b/libgfortran/generated/minloc0_8_i1.c @@ -58,7 +58,7 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_i16.c b/libgfortran/generated/minloc0_8_i16.c index 32a2b5a3d3c..27ddd4f9923 100644 --- a/libgfortran/generated/minloc0_8_i16.c +++ b/libgfortran/generated/minloc0_8_i16.c @@ -58,7 +58,7 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_i2.c b/libgfortran/generated/minloc0_8_i2.c index a0061d28e9e..38a4aa64ed4 100644 --- a/libgfortran/generated/minloc0_8_i2.c +++ b/libgfortran/generated/minloc0_8_i2.c @@ -58,7 +58,7 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_i4.c b/libgfortran/generated/minloc0_8_i4.c index 3ea2487dcc1..5586ea9fae4 100644 --- a/libgfortran/generated/minloc0_8_i4.c +++ b/libgfortran/generated/minloc0_8_i4.c @@ -58,7 +58,7 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_i8.c b/libgfortran/generated/minloc0_8_i8.c index afc6d44e486..1f21d2657d9 100644 --- a/libgfortran/generated/minloc0_8_i8.c +++ b/libgfortran/generated/minloc0_8_i8.c @@ -58,7 +58,7 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_r10.c b/libgfortran/generated/minloc0_8_r10.c index 6abc03d01d4..df34ca3336c 100644 --- a/libgfortran/generated/minloc0_8_r10.c +++ b/libgfortran/generated/minloc0_8_r10.c @@ -58,7 +58,7 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_r16.c b/libgfortran/generated/minloc0_8_r16.c index 322951e48d0..d8769ec950e 100644 --- a/libgfortran/generated/minloc0_8_r16.c +++ b/libgfortran/generated/minloc0_8_r16.c @@ -58,7 +58,7 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_r4.c b/libgfortran/generated/minloc0_8_r4.c index c9896d744d5..b8ab0c9903c 100644 --- a/libgfortran/generated/minloc0_8_r4.c +++ b/libgfortran/generated/minloc0_8_r4.c @@ -58,7 +58,7 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_r8.c b/libgfortran/generated/minloc0_8_r8.c index edada9004b8..ff67f1ed5e3 100644 --- a/libgfortran/generated/minloc0_8_r8.c +++ b/libgfortran/generated/minloc0_8_r8.c @@ -58,7 +58,7 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc1_16_i1.c b/libgfortran/generated/minloc1_16_i1.c index d47e946f0f3..a9b2d96b1cc 100644 --- a/libgfortran/generated/minloc1_16_i1.c +++ b/libgfortran/generated/minloc1_16_i1.c @@ -98,10 +98,9 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_i16.c b/libgfortran/generated/minloc1_16_i16.c index aca08c0c178..1e52c222033 100644 --- a/libgfortran/generated/minloc1_16_i16.c +++ b/libgfortran/generated/minloc1_16_i16.c @@ -98,10 +98,9 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_i2.c b/libgfortran/generated/minloc1_16_i2.c index 27eb379e7ee..7617b9e32b5 100644 --- a/libgfortran/generated/minloc1_16_i2.c +++ b/libgfortran/generated/minloc1_16_i2.c @@ -98,10 +98,9 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_i4.c b/libgfortran/generated/minloc1_16_i4.c index 4a30ac1fafb..9729d11bce8 100644 --- a/libgfortran/generated/minloc1_16_i4.c +++ b/libgfortran/generated/minloc1_16_i4.c @@ -98,10 +98,9 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_i8.c b/libgfortran/generated/minloc1_16_i8.c index 4021ac22874..00421b23540 100644 --- a/libgfortran/generated/minloc1_16_i8.c +++ b/libgfortran/generated/minloc1_16_i8.c @@ -98,10 +98,9 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_r10.c b/libgfortran/generated/minloc1_16_r10.c index c8eadc34cce..fb1401b9517 100644 --- a/libgfortran/generated/minloc1_16_r10.c +++ b/libgfortran/generated/minloc1_16_r10.c @@ -98,10 +98,9 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_r16.c b/libgfortran/generated/minloc1_16_r16.c index 6aa1de83622..031286809e6 100644 --- a/libgfortran/generated/minloc1_16_r16.c +++ b/libgfortran/generated/minloc1_16_r16.c @@ -98,10 +98,9 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_r4.c b/libgfortran/generated/minloc1_16_r4.c index 67e5564daad..af5b67d900b 100644 --- a/libgfortran/generated/minloc1_16_r4.c +++ b/libgfortran/generated/minloc1_16_r4.c @@ -98,10 +98,9 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_r8.c b/libgfortran/generated/minloc1_16_r8.c index 1fcef6c5abb..dd2be3bb4de 100644 --- a/libgfortran/generated/minloc1_16_r8.c +++ b/libgfortran/generated/minloc1_16_r8.c @@ -98,10 +98,9 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_4_i1.c b/libgfortran/generated/minloc1_4_i1.c index 863f873f780..b0bf6efba8a 100644 --- a/libgfortran/generated/minloc1_4_i1.c +++ b/libgfortran/generated/minloc1_4_i1.c @@ -98,10 +98,9 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_i16.c b/libgfortran/generated/minloc1_4_i16.c index 9a81558f4d5..882b4b41744 100644 --- a/libgfortran/generated/minloc1_4_i16.c +++ b/libgfortran/generated/minloc1_4_i16.c @@ -98,10 +98,9 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_i2.c b/libgfortran/generated/minloc1_4_i2.c index 6657c9f1d97..877af7a5a0c 100644 --- a/libgfortran/generated/minloc1_4_i2.c +++ b/libgfortran/generated/minloc1_4_i2.c @@ -98,10 +98,9 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_i4.c b/libgfortran/generated/minloc1_4_i4.c index 36e9552c455..3a872706d12 100644 --- a/libgfortran/generated/minloc1_4_i4.c +++ b/libgfortran/generated/minloc1_4_i4.c @@ -98,10 +98,9 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c index c5d78283197..22e43bf6c85 100644 --- a/libgfortran/generated/minloc1_4_i8.c +++ b/libgfortran/generated/minloc1_4_i8.c @@ -98,10 +98,9 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_r10.c b/libgfortran/generated/minloc1_4_r10.c index f55791c0130..624006cd694 100644 --- a/libgfortran/generated/minloc1_4_r10.c +++ b/libgfortran/generated/minloc1_4_r10.c @@ -98,10 +98,9 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_r16.c b/libgfortran/generated/minloc1_4_r16.c index 99163f439d3..f32b6082522 100644 --- a/libgfortran/generated/minloc1_4_r16.c +++ b/libgfortran/generated/minloc1_4_r16.c @@ -98,10 +98,9 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_r4.c b/libgfortran/generated/minloc1_4_r4.c index 9e857450487..0ed5fe96e7b 100644 --- a/libgfortran/generated/minloc1_4_r4.c +++ b/libgfortran/generated/minloc1_4_r4.c @@ -98,10 +98,9 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_r8.c b/libgfortran/generated/minloc1_4_r8.c index 75f2a5ff1c3..c780a42aa2e 100644 --- a/libgfortran/generated/minloc1_4_r8.c +++ b/libgfortran/generated/minloc1_4_r8.c @@ -98,10 +98,9 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_8_i1.c b/libgfortran/generated/minloc1_8_i1.c index 8c065ec479e..6f8c7d9443c 100644 --- a/libgfortran/generated/minloc1_8_i1.c +++ b/libgfortran/generated/minloc1_8_i1.c @@ -98,10 +98,9 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_i16.c b/libgfortran/generated/minloc1_8_i16.c index 68c96177303..07cb01171a1 100644 --- a/libgfortran/generated/minloc1_8_i16.c +++ b/libgfortran/generated/minloc1_8_i16.c @@ -98,10 +98,9 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_i2.c b/libgfortran/generated/minloc1_8_i2.c index 3e4f4f05bd3..9ea0bf4c342 100644 --- a/libgfortran/generated/minloc1_8_i2.c +++ b/libgfortran/generated/minloc1_8_i2.c @@ -98,10 +98,9 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_i4.c b/libgfortran/generated/minloc1_8_i4.c index b0e753af228..5e433cc1dea 100644 --- a/libgfortran/generated/minloc1_8_i4.c +++ b/libgfortran/generated/minloc1_8_i4.c @@ -98,10 +98,9 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_i8.c b/libgfortran/generated/minloc1_8_i8.c index a7fec907047..364cf324959 100644 --- a/libgfortran/generated/minloc1_8_i8.c +++ b/libgfortran/generated/minloc1_8_i8.c @@ -98,10 +98,9 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_r10.c b/libgfortran/generated/minloc1_8_r10.c index 6b3e80f0a34..901cf91a3f6 100644 --- a/libgfortran/generated/minloc1_8_r10.c +++ b/libgfortran/generated/minloc1_8_r10.c @@ -98,10 +98,9 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c index 7b69876e22e..7bf17ea37ef 100644 --- a/libgfortran/generated/minloc1_8_r16.c +++ b/libgfortran/generated/minloc1_8_r16.c @@ -98,10 +98,9 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_r4.c b/libgfortran/generated/minloc1_8_r4.c index 13d40ea9a77..5edb92f9958 100644 --- a/libgfortran/generated/minloc1_8_r4.c +++ b/libgfortran/generated/minloc1_8_r4.c @@ -98,10 +98,9 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_r8.c b/libgfortran/generated/minloc1_8_r8.c index 51151f23657..405b9e1834b 100644 --- a/libgfortran/generated/minloc1_8_r8.c +++ b/libgfortran/generated/minloc1_8_r8.c @@ -98,10 +98,9 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minval_i1.c b/libgfortran/generated/minval_i1.c index 261dac8e434..da7405b2830 100644 --- a/libgfortran/generated/minval_i1.c +++ b/libgfortran/generated/minval_i1.c @@ -97,10 +97,9 @@ minval_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -472,8 +470,7 @@ sminval_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/minval_i16.c b/libgfortran/generated/minval_i16.c index c75db96829f..11cbeac5ff6 100644 --- a/libgfortran/generated/minval_i16.c +++ b/libgfortran/generated/minval_i16.c @@ -97,10 +97,9 @@ minval_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -472,8 +470,7 @@ sminval_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minval_i2.c b/libgfortran/generated/minval_i2.c index 5e7a3642e1c..e208b57e2ee 100644 --- a/libgfortran/generated/minval_i2.c +++ b/libgfortran/generated/minval_i2.c @@ -97,10 +97,9 @@ minval_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -472,8 +470,7 @@ sminval_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/minval_i4.c b/libgfortran/generated/minval_i4.c index a8aed7dc0c1..68ba76e8d4c 100644 --- a/libgfortran/generated/minval_i4.c +++ b/libgfortran/generated/minval_i4.c @@ -97,10 +97,9 @@ minval_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -472,8 +470,7 @@ sminval_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minval_i8.c b/libgfortran/generated/minval_i8.c index 1d489bc55a4..b089358d048 100644 --- a/libgfortran/generated/minval_i8.c +++ b/libgfortran/generated/minval_i8.c @@ -97,10 +97,9 @@ minval_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -472,8 +470,7 @@ sminval_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minval_r10.c b/libgfortran/generated/minval_r10.c index 9181e21d7af..e9e6afee615 100644 --- a/libgfortran/generated/minval_r10.c +++ b/libgfortran/generated/minval_r10.c @@ -97,10 +97,9 @@ minval_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else @@ -472,8 +470,7 @@ sminval_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else { diff --git a/libgfortran/generated/minval_r16.c b/libgfortran/generated/minval_r16.c index 85aaa5dbef8..e4e38275d3f 100644 --- a/libgfortran/generated/minval_r16.c +++ b/libgfortran/generated/minval_r16.c @@ -97,10 +97,9 @@ minval_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else @@ -472,8 +470,7 @@ sminval_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else { diff --git a/libgfortran/generated/minval_r4.c b/libgfortran/generated/minval_r4.c index 19a258c81da..515b2db4976 100644 --- a/libgfortran/generated/minval_r4.c +++ b/libgfortran/generated/minval_r4.c @@ -97,10 +97,9 @@ minval_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else @@ -472,8 +470,7 @@ sminval_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else { diff --git a/libgfortran/generated/minval_r8.c b/libgfortran/generated/minval_r8.c index d2f96397651..c61656f874e 100644 --- a/libgfortran/generated/minval_r8.c +++ b/libgfortran/generated/minval_r8.c @@ -97,10 +97,9 @@ minval_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else @@ -472,8 +470,7 @@ sminval_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else { diff --git a/libgfortran/generated/norm2_r10.c b/libgfortran/generated/norm2_r10.c index 44028ccb249..0145c99b652 100644 --- a/libgfortran/generated/norm2_r10.c +++ b/libgfortran/generated/norm2_r10.c @@ -101,10 +101,9 @@ norm2_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/norm2_r16.c b/libgfortran/generated/norm2_r16.c index c036edce899..46329d52329 100644 --- a/libgfortran/generated/norm2_r16.c +++ b/libgfortran/generated/norm2_r16.c @@ -105,10 +105,9 @@ norm2_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/norm2_r4.c b/libgfortran/generated/norm2_r4.c index dcf78daf947..067dbee6292 100644 --- a/libgfortran/generated/norm2_r4.c +++ b/libgfortran/generated/norm2_r4.c @@ -101,10 +101,9 @@ norm2_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/norm2_r8.c b/libgfortran/generated/norm2_r8.c index 1bda1c5e06f..51c89427a4a 100644 --- a/libgfortran/generated/norm2_r8.c +++ b/libgfortran/generated/norm2_r8.c @@ -101,10 +101,9 @@ norm2_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/pack_c10.c b/libgfortran/generated/pack_c10.c index 9fcacf12ede..90866a840d1 100644 --- a/libgfortran/generated/pack_c10.c +++ b/libgfortran/generated/pack_c10.c @@ -167,8 +167,8 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_10) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_10)); if (total == 0) return; diff --git a/libgfortran/generated/pack_c16.c b/libgfortran/generated/pack_c16.c index 0e3db34527f..60f60d1e43d 100644 --- a/libgfortran/generated/pack_c16.c +++ b/libgfortran/generated/pack_c16.c @@ -167,8 +167,8 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_16) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_16)); if (total == 0) return; diff --git a/libgfortran/generated/pack_c4.c b/libgfortran/generated/pack_c4.c index f17d35abfff..36a9f941c73 100644 --- a/libgfortran/generated/pack_c4.c +++ b/libgfortran/generated/pack_c4.c @@ -167,8 +167,8 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_4) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_4)); if (total == 0) return; diff --git a/libgfortran/generated/pack_c8.c b/libgfortran/generated/pack_c8.c index f291b467693..38880c1831a 100644 --- a/libgfortran/generated/pack_c8.c +++ b/libgfortran/generated/pack_c8.c @@ -167,8 +167,8 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_8) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_8)); if (total == 0) return; diff --git a/libgfortran/generated/pack_i1.c b/libgfortran/generated/pack_i1.c index b70127d5bfc..933cf9ab796 100644 --- a/libgfortran/generated/pack_i1.c +++ b/libgfortran/generated/pack_i1.c @@ -167,8 +167,8 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_1) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_1)); if (total == 0) return; diff --git a/libgfortran/generated/pack_i16.c b/libgfortran/generated/pack_i16.c index da1faefd450..01d32ad0fad 100644 --- a/libgfortran/generated/pack_i16.c +++ b/libgfortran/generated/pack_i16.c @@ -167,8 +167,8 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_16)); if (total == 0) return; diff --git a/libgfortran/generated/pack_i2.c b/libgfortran/generated/pack_i2.c index 0481720d4bd..de329abf11a 100644 --- a/libgfortran/generated/pack_i2.c +++ b/libgfortran/generated/pack_i2.c @@ -167,8 +167,8 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_2) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_2)); if (total == 0) return; diff --git a/libgfortran/generated/pack_i4.c b/libgfortran/generated/pack_i4.c index 0a0b4ba3801..93ac356f81a 100644 --- a/libgfortran/generated/pack_i4.c +++ b/libgfortran/generated/pack_i4.c @@ -167,8 +167,8 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_4)); if (total == 0) return; diff --git a/libgfortran/generated/pack_i8.c b/libgfortran/generated/pack_i8.c index 183a0fef725..ec7b4275c3d 100644 --- a/libgfortran/generated/pack_i8.c +++ b/libgfortran/generated/pack_i8.c @@ -167,8 +167,8 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_8)); if (total == 0) return; diff --git a/libgfortran/generated/pack_r10.c b/libgfortran/generated/pack_r10.c index d1c22973d40..8b3e81693a5 100644 --- a/libgfortran/generated/pack_r10.c +++ b/libgfortran/generated/pack_r10.c @@ -167,8 +167,8 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_10)); if (total == 0) return; diff --git a/libgfortran/generated/pack_r16.c b/libgfortran/generated/pack_r16.c index 59a6f5872e7..598ef8e576a 100644 --- a/libgfortran/generated/pack_r16.c +++ b/libgfortran/generated/pack_r16.c @@ -167,8 +167,8 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_16)); if (total == 0) return; diff --git a/libgfortran/generated/pack_r4.c b/libgfortran/generated/pack_r4.c index 86ec8ffef17..955a812d248 100644 --- a/libgfortran/generated/pack_r4.c +++ b/libgfortran/generated/pack_r4.c @@ -167,8 +167,8 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_4)); if (total == 0) return; diff --git a/libgfortran/generated/pack_r8.c b/libgfortran/generated/pack_r8.c index 6d7c155105f..d0bb227e163 100644 --- a/libgfortran/generated/pack_r8.c +++ b/libgfortran/generated/pack_r8.c @@ -167,8 +167,8 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_8)); if (total == 0) return; diff --git a/libgfortran/generated/parity_l1.c b/libgfortran/generated/parity_l1.c index f71e9ad484e..ff81d1ac5ed 100644 --- a/libgfortran/generated/parity_l1.c +++ b/libgfortran/generated/parity_l1.c @@ -98,10 +98,9 @@ parity_l1 (gfc_array_l1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/parity_l16.c b/libgfortran/generated/parity_l16.c index ba50d96408a..66970d00f94 100644 --- a/libgfortran/generated/parity_l16.c +++ b/libgfortran/generated/parity_l16.c @@ -98,10 +98,9 @@ parity_l16 (gfc_array_l16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/parity_l2.c b/libgfortran/generated/parity_l2.c index b719eb88279..5942257e3d6 100644 --- a/libgfortran/generated/parity_l2.c +++ b/libgfortran/generated/parity_l2.c @@ -98,10 +98,9 @@ parity_l2 (gfc_array_l2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/parity_l4.c b/libgfortran/generated/parity_l4.c index 7274d72c254..4f8a9f91756 100644 --- a/libgfortran/generated/parity_l4.c +++ b/libgfortran/generated/parity_l4.c @@ -98,10 +98,9 @@ parity_l4 (gfc_array_l4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/parity_l8.c b/libgfortran/generated/parity_l8.c index 9c4e5717767..73b1d9fba33 100644 --- a/libgfortran/generated/parity_l8.c +++ b/libgfortran/generated/parity_l8.c @@ -98,10 +98,9 @@ parity_l8 (gfc_array_l8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/product_c10.c b/libgfortran/generated/product_c10.c index 6b2ea5fb038..7b325837aed 100644 --- a/libgfortran/generated/product_c10.c +++ b/libgfortran/generated/product_c10.c @@ -97,10 +97,9 @@ product_c10 (gfc_array_c10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); } else @@ -430,8 +428,7 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); } else { diff --git a/libgfortran/generated/product_c16.c b/libgfortran/generated/product_c16.c index 42d5dcdb692..4f31e1b63d0 100644 --- a/libgfortran/generated/product_c16.c +++ b/libgfortran/generated/product_c16.c @@ -97,10 +97,9 @@ product_c16 (gfc_array_c16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); } else @@ -430,8 +428,7 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); } else { diff --git a/libgfortran/generated/product_c4.c b/libgfortran/generated/product_c4.c index 04d3cf9c410..038c502d479 100644 --- a/libgfortran/generated/product_c4.c +++ b/libgfortran/generated/product_c4.c @@ -97,10 +97,9 @@ product_c4 (gfc_array_c4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); } else @@ -430,8 +428,7 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); } else { diff --git a/libgfortran/generated/product_c8.c b/libgfortran/generated/product_c8.c index 184e1bc506d..a941a6c624a 100644 --- a/libgfortran/generated/product_c8.c +++ b/libgfortran/generated/product_c8.c @@ -97,10 +97,9 @@ product_c8 (gfc_array_c8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); } else @@ -430,8 +428,7 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); } else { diff --git a/libgfortran/generated/product_i1.c b/libgfortran/generated/product_i1.c index 0a8bc26897f..39d94fc81ec 100644 --- a/libgfortran/generated/product_i1.c +++ b/libgfortran/generated/product_i1.c @@ -97,10 +97,9 @@ product_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -430,8 +428,7 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/product_i16.c b/libgfortran/generated/product_i16.c index 97c774afe6a..a89070a44ec 100644 --- a/libgfortran/generated/product_i16.c +++ b/libgfortran/generated/product_i16.c @@ -97,10 +97,9 @@ product_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -430,8 +428,7 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/product_i2.c b/libgfortran/generated/product_i2.c index 86d85eedd32..c8e04ef85dc 100644 --- a/libgfortran/generated/product_i2.c +++ b/libgfortran/generated/product_i2.c @@ -97,10 +97,9 @@ product_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -430,8 +428,7 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/product_i4.c b/libgfortran/generated/product_i4.c index 6e73740320a..1d3b9cf6a12 100644 --- a/libgfortran/generated/product_i4.c +++ b/libgfortran/generated/product_i4.c @@ -97,10 +97,9 @@ product_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -430,8 +428,7 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/product_i8.c b/libgfortran/generated/product_i8.c index c49f57219d1..7d61b9ba280 100644 --- a/libgfortran/generated/product_i8.c +++ b/libgfortran/generated/product_i8.c @@ -97,10 +97,9 @@ product_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -430,8 +428,7 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/product_r10.c b/libgfortran/generated/product_r10.c index 5aa856349e6..16aa3059e14 100644 --- a/libgfortran/generated/product_r10.c +++ b/libgfortran/generated/product_r10.c @@ -97,10 +97,9 @@ product_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else @@ -430,8 +428,7 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else { diff --git a/libgfortran/generated/product_r16.c b/libgfortran/generated/product_r16.c index 63bf37263d0..3bb085ff19b 100644 --- a/libgfortran/generated/product_r16.c +++ b/libgfortran/generated/product_r16.c @@ -97,10 +97,9 @@ product_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else @@ -430,8 +428,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else { diff --git a/libgfortran/generated/product_r4.c b/libgfortran/generated/product_r4.c index 2d852130aa7..18dfdde9672 100644 --- a/libgfortran/generated/product_r4.c +++ b/libgfortran/generated/product_r4.c @@ -97,10 +97,9 @@ product_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else @@ -430,8 +428,7 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else { diff --git a/libgfortran/generated/product_r8.c b/libgfortran/generated/product_r8.c index 9cb1a177ec7..7ac062aa98f 100644 --- a/libgfortran/generated/product_r8.c +++ b/libgfortran/generated/product_r8.c @@ -97,10 +97,9 @@ product_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else @@ -430,8 +428,7 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else { diff --git a/libgfortran/generated/reshape_c10.c b/libgfortran/generated/reshape_c10.c index e516e074c1a..a7fb560d632 100644 --- a/libgfortran/generated/reshape_c10.c +++ b/libgfortran/generated/reshape_c10.c @@ -111,11 +111,11 @@ reshape_c10 (gfc_array_c10 * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof (GFC_COMPLEX_10); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_c16.c b/libgfortran/generated/reshape_c16.c index c374af88866..a8186f98d53 100644 --- a/libgfortran/generated/reshape_c16.c +++ b/libgfortran/generated/reshape_c16.c @@ -111,11 +111,11 @@ reshape_c16 (gfc_array_c16 * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof (GFC_COMPLEX_16); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_c4.c b/libgfortran/generated/reshape_c4.c index b0043028bb0..1aa1934cef7 100644 --- a/libgfortran/generated/reshape_c4.c +++ b/libgfortran/generated/reshape_c4.c @@ -111,11 +111,11 @@ reshape_c4 (gfc_array_c4 * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof (GFC_COMPLEX_4); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_c8.c b/libgfortran/generated/reshape_c8.c index 345dcccb295..5b7f796234e 100644 --- a/libgfortran/generated/reshape_c8.c +++ b/libgfortran/generated/reshape_c8.c @@ -111,11 +111,11 @@ reshape_c8 (gfc_array_c8 * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof (GFC_COMPLEX_8); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_i16.c b/libgfortran/generated/reshape_i16.c index f05a93727eb..b766e1a9acf 100644 --- a/libgfortran/generated/reshape_i16.c +++ b/libgfortran/generated/reshape_i16.c @@ -111,11 +111,11 @@ reshape_16 (gfc_array_i16 * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof (GFC_INTEGER_16); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_i4.c b/libgfortran/generated/reshape_i4.c index 174b4ca9444..4831857b827 100644 --- a/libgfortran/generated/reshape_i4.c +++ b/libgfortran/generated/reshape_i4.c @@ -111,11 +111,11 @@ reshape_4 (gfc_array_i4 * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof (GFC_INTEGER_4); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_i8.c b/libgfortran/generated/reshape_i8.c index c377752485a..1729d488bae 100644 --- a/libgfortran/generated/reshape_i8.c +++ b/libgfortran/generated/reshape_i8.c @@ -111,11 +111,11 @@ reshape_8 (gfc_array_i8 * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof (GFC_INTEGER_8); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_r10.c b/libgfortran/generated/reshape_r10.c index ee2c47f2105..f1dd44a43a6 100644 --- a/libgfortran/generated/reshape_r10.c +++ b/libgfortran/generated/reshape_r10.c @@ -111,11 +111,11 @@ reshape_r10 (gfc_array_r10 * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof (GFC_REAL_10); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_r16.c b/libgfortran/generated/reshape_r16.c index 61c8de4d6f6..360b18ffdf4 100644 --- a/libgfortran/generated/reshape_r16.c +++ b/libgfortran/generated/reshape_r16.c @@ -111,11 +111,11 @@ reshape_r16 (gfc_array_r16 * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof (GFC_REAL_16); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_r4.c b/libgfortran/generated/reshape_r4.c index d7ca64f5ed6..e06cb541799 100644 --- a/libgfortran/generated/reshape_r4.c +++ b/libgfortran/generated/reshape_r4.c @@ -111,11 +111,11 @@ reshape_r4 (gfc_array_r4 * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof (GFC_REAL_4); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_r8.c b/libgfortran/generated/reshape_r8.c index 9700a586104..08888a8ad8e 100644 --- a/libgfortran/generated/reshape_r8.c +++ b/libgfortran/generated/reshape_r8.c @@ -111,11 +111,11 @@ reshape_r8 (gfc_array_r8 * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof (GFC_REAL_8); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/shape_i16.c b/libgfortran/generated/shape_i16.c index c23f6d4f1fc..c5047562d7f 100644 --- a/libgfortran/generated/shape_i16.c +++ b/libgfortran/generated/shape_i16.c @@ -49,7 +49,7 @@ shape_16 (gfc_array_i16 * const restrict ret, { GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1); ret->offset = 0; - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } stride = GFC_DESCRIPTOR_STRIDE(ret,0); diff --git a/libgfortran/generated/shape_i4.c b/libgfortran/generated/shape_i4.c index 1abac162db0..0a56fe9fe92 100644 --- a/libgfortran/generated/shape_i4.c +++ b/libgfortran/generated/shape_i4.c @@ -49,7 +49,7 @@ shape_4 (gfc_array_i4 * const restrict ret, { GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1); ret->offset = 0; - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } stride = GFC_DESCRIPTOR_STRIDE(ret,0); diff --git a/libgfortran/generated/shape_i8.c b/libgfortran/generated/shape_i8.c index 707d26c0b17..6e9dc22583d 100644 --- a/libgfortran/generated/shape_i8.c +++ b/libgfortran/generated/shape_i8.c @@ -49,7 +49,7 @@ shape_8 (gfc_array_i8 * const restrict ret, { GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1); ret->offset = 0; - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } stride = GFC_DESCRIPTOR_STRIDE(ret,0); diff --git a/libgfortran/generated/spread_c10.c b/libgfortran/generated/spread_c10.c index ad58e34bc22..592443e71aa 100644 --- a/libgfortran/generated/spread_c10.c +++ b/libgfortran/generated/spread_c10.c @@ -101,8 +101,8 @@ spread_c10 (gfc_array_c10 *ret, const gfc_array_c10 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_10)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_10)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_c10 (gfc_array_c10 *ret, const GFC_COMPLEX_10 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_10)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_10)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_c16.c b/libgfortran/generated/spread_c16.c index 31e82ac5822..0fce566d751 100644 --- a/libgfortran/generated/spread_c16.c +++ b/libgfortran/generated/spread_c16.c @@ -101,8 +101,8 @@ spread_c16 (gfc_array_c16 *ret, const gfc_array_c16 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_16)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_16)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_c16 (gfc_array_c16 *ret, const GFC_COMPLEX_16 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_16)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_16)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_c4.c b/libgfortran/generated/spread_c4.c index f17c6ba9f95..5d1e86b3756 100644 --- a/libgfortran/generated/spread_c4.c +++ b/libgfortran/generated/spread_c4.c @@ -101,8 +101,8 @@ spread_c4 (gfc_array_c4 *ret, const gfc_array_c4 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_4)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_4)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_c4 (gfc_array_c4 *ret, const GFC_COMPLEX_4 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_4)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_4)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_c8.c b/libgfortran/generated/spread_c8.c index 07347a28b29..f8b0da8bc76 100644 --- a/libgfortran/generated/spread_c8.c +++ b/libgfortran/generated/spread_c8.c @@ -101,8 +101,8 @@ spread_c8 (gfc_array_c8 *ret, const gfc_array_c8 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_8)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_8)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_c8 (gfc_array_c8 *ret, const GFC_COMPLEX_8 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_8)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_8)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_i1.c b/libgfortran/generated/spread_i1.c index 083d26e41b9..44aef16d3df 100644 --- a/libgfortran/generated/spread_i1.c +++ b/libgfortran/generated/spread_i1.c @@ -101,8 +101,8 @@ spread_i1 (gfc_array_i1 *ret, const gfc_array_i1 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_1)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_1)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_i1 (gfc_array_i1 *ret, const GFC_INTEGER_1 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_1)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_1)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_i16.c b/libgfortran/generated/spread_i16.c index fb565c3c36e..f4ad0180cce 100644 --- a/libgfortran/generated/spread_i16.c +++ b/libgfortran/generated/spread_i16.c @@ -101,8 +101,8 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_16)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_16)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_i16 (gfc_array_i16 *ret, const GFC_INTEGER_16 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_16)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_16)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_i2.c b/libgfortran/generated/spread_i2.c index 5895594d827..02e7628394a 100644 --- a/libgfortran/generated/spread_i2.c +++ b/libgfortran/generated/spread_i2.c @@ -101,8 +101,8 @@ spread_i2 (gfc_array_i2 *ret, const gfc_array_i2 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_2)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_2)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_i2 (gfc_array_i2 *ret, const GFC_INTEGER_2 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_2)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_2)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_i4.c b/libgfortran/generated/spread_i4.c index 4cb64b0e8ef..0c8d9273657 100644 --- a/libgfortran/generated/spread_i4.c +++ b/libgfortran/generated/spread_i4.c @@ -101,8 +101,8 @@ spread_i4 (gfc_array_i4 *ret, const gfc_array_i4 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_4)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_4)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_i4 (gfc_array_i4 *ret, const GFC_INTEGER_4 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_4)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_4)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_i8.c b/libgfortran/generated/spread_i8.c index 2013c898e88..402c746cf3e 100644 --- a/libgfortran/generated/spread_i8.c +++ b/libgfortran/generated/spread_i8.c @@ -101,8 +101,8 @@ spread_i8 (gfc_array_i8 *ret, const gfc_array_i8 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_8)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_8)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_i8 (gfc_array_i8 *ret, const GFC_INTEGER_8 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_8)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_8)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_r10.c b/libgfortran/generated/spread_r10.c index d43f745756e..248186eb3f8 100644 --- a/libgfortran/generated/spread_r10.c +++ b/libgfortran/generated/spread_r10.c @@ -101,8 +101,8 @@ spread_r10 (gfc_array_r10 *ret, const gfc_array_r10 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_10)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_10)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_r10 (gfc_array_r10 *ret, const GFC_REAL_10 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_10)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_10)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_r16.c b/libgfortran/generated/spread_r16.c index f7452a111f5..50aef1087b9 100644 --- a/libgfortran/generated/spread_r16.c +++ b/libgfortran/generated/spread_r16.c @@ -101,8 +101,8 @@ spread_r16 (gfc_array_r16 *ret, const gfc_array_r16 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_16)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_16)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_r16 (gfc_array_r16 *ret, const GFC_REAL_16 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_16)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_16)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_r4.c b/libgfortran/generated/spread_r4.c index b5383fa97d2..fab55c7a1db 100644 --- a/libgfortran/generated/spread_r4.c +++ b/libgfortran/generated/spread_r4.c @@ -101,8 +101,8 @@ spread_r4 (gfc_array_r4 *ret, const gfc_array_r4 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_4)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_4)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_r4 (gfc_array_r4 *ret, const GFC_REAL_4 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_4)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_4)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_r8.c b/libgfortran/generated/spread_r8.c index 78bbcdc5761..6076638d715 100644 --- a/libgfortran/generated/spread_r8.c +++ b/libgfortran/generated/spread_r8.c @@ -101,8 +101,8 @@ spread_r8 (gfc_array_r8 *ret, const gfc_array_r8 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_8)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_8)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_r8 (gfc_array_r8 *ret, const GFC_REAL_8 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_8)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_8)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/sum_c10.c b/libgfortran/generated/sum_c10.c index cb5fff68b84..176623dfff6 100644 --- a/libgfortran/generated/sum_c10.c +++ b/libgfortran/generated/sum_c10.c @@ -97,10 +97,9 @@ sum_c10 (gfc_array_c10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); } else @@ -430,8 +428,7 @@ ssum_c10 (gfc_array_c10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_c10 (gfc_array_c10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); } else { diff --git a/libgfortran/generated/sum_c16.c b/libgfortran/generated/sum_c16.c index 3f616ec85fd..055a659304d 100644 --- a/libgfortran/generated/sum_c16.c +++ b/libgfortran/generated/sum_c16.c @@ -97,10 +97,9 @@ sum_c16 (gfc_array_c16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); } else @@ -430,8 +428,7 @@ ssum_c16 (gfc_array_c16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_c16 (gfc_array_c16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); } else { diff --git a/libgfortran/generated/sum_c4.c b/libgfortran/generated/sum_c4.c index ec5160e3dba..6fab436b2c4 100644 --- a/libgfortran/generated/sum_c4.c +++ b/libgfortran/generated/sum_c4.c @@ -97,10 +97,9 @@ sum_c4 (gfc_array_c4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); } else @@ -430,8 +428,7 @@ ssum_c4 (gfc_array_c4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_c4 (gfc_array_c4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); } else { diff --git a/libgfortran/generated/sum_c8.c b/libgfortran/generated/sum_c8.c index 946c722d733..c3d35804d64 100644 --- a/libgfortran/generated/sum_c8.c +++ b/libgfortran/generated/sum_c8.c @@ -97,10 +97,9 @@ sum_c8 (gfc_array_c8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); } else @@ -430,8 +428,7 @@ ssum_c8 (gfc_array_c8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_c8 (gfc_array_c8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); } else { diff --git a/libgfortran/generated/sum_i1.c b/libgfortran/generated/sum_i1.c index 477581f96f3..88ee3338b82 100644 --- a/libgfortran/generated/sum_i1.c +++ b/libgfortran/generated/sum_i1.c @@ -97,10 +97,9 @@ sum_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -430,8 +428,7 @@ ssum_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/sum_i16.c b/libgfortran/generated/sum_i16.c index 52c12a7df95..dc35e0709e7 100644 --- a/libgfortran/generated/sum_i16.c +++ b/libgfortran/generated/sum_i16.c @@ -97,10 +97,9 @@ sum_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -430,8 +428,7 @@ ssum_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/sum_i2.c b/libgfortran/generated/sum_i2.c index af6e29deeef..05c08820675 100644 --- a/libgfortran/generated/sum_i2.c +++ b/libgfortran/generated/sum_i2.c @@ -97,10 +97,9 @@ sum_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -430,8 +428,7 @@ ssum_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/sum_i4.c b/libgfortran/generated/sum_i4.c index 87b10c7d0ea..3653883c4a6 100644 --- a/libgfortran/generated/sum_i4.c +++ b/libgfortran/generated/sum_i4.c @@ -97,10 +97,9 @@ sum_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -430,8 +428,7 @@ ssum_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/sum_i8.c b/libgfortran/generated/sum_i8.c index bc8b52ebc5a..d2878df6f83 100644 --- a/libgfortran/generated/sum_i8.c +++ b/libgfortran/generated/sum_i8.c @@ -97,10 +97,9 @@ sum_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -430,8 +428,7 @@ ssum_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/sum_r10.c b/libgfortran/generated/sum_r10.c index 97bb66f3d8f..cb5169c8a75 100644 --- a/libgfortran/generated/sum_r10.c +++ b/libgfortran/generated/sum_r10.c @@ -97,10 +97,9 @@ sum_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else @@ -430,8 +428,7 @@ ssum_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else { diff --git a/libgfortran/generated/sum_r16.c b/libgfortran/generated/sum_r16.c index c089cfdfa68..6c67f295f41 100644 --- a/libgfortran/generated/sum_r16.c +++ b/libgfortran/generated/sum_r16.c @@ -97,10 +97,9 @@ sum_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else @@ -430,8 +428,7 @@ ssum_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else { diff --git a/libgfortran/generated/sum_r4.c b/libgfortran/generated/sum_r4.c index 2fea0b7e259..a3a4b59cee6 100644 --- a/libgfortran/generated/sum_r4.c +++ b/libgfortran/generated/sum_r4.c @@ -97,10 +97,9 @@ sum_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else @@ -430,8 +428,7 @@ ssum_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else { diff --git a/libgfortran/generated/sum_r8.c b/libgfortran/generated/sum_r8.c index e52795da42c..0cbf649db2a 100644 --- a/libgfortran/generated/sum_r8.c +++ b/libgfortran/generated/sum_r8.c @@ -97,10 +97,9 @@ sum_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else @@ -430,8 +428,7 @@ ssum_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else { diff --git a/libgfortran/generated/transpose_c10.c b/libgfortran/generated/transpose_c10.c index e55883383bb..bd201220923 100644 --- a/libgfortran/generated/transpose_c10.c +++ b/libgfortran/generated/transpose_c10.c @@ -60,7 +60,8 @@ transpose_c10 (gfc_array_c10 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_COMPLEX_10)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_c16.c b/libgfortran/generated/transpose_c16.c index f11128eddd0..044509f67f0 100644 --- a/libgfortran/generated/transpose_c16.c +++ b/libgfortran/generated/transpose_c16.c @@ -60,7 +60,8 @@ transpose_c16 (gfc_array_c16 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_COMPLEX_16)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_c4.c b/libgfortran/generated/transpose_c4.c index f1e5fcebead..c6dd90580e6 100644 --- a/libgfortran/generated/transpose_c4.c +++ b/libgfortran/generated/transpose_c4.c @@ -60,7 +60,8 @@ transpose_c4 (gfc_array_c4 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_COMPLEX_4)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_c8.c b/libgfortran/generated/transpose_c8.c index 46fde201f92..cd5926bf843 100644 --- a/libgfortran/generated/transpose_c8.c +++ b/libgfortran/generated/transpose_c8.c @@ -60,7 +60,8 @@ transpose_c8 (gfc_array_c8 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_COMPLEX_8)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_i16.c b/libgfortran/generated/transpose_i16.c index 236fcf1b510..44aff01ff5f 100644 --- a/libgfortran/generated/transpose_i16.c +++ b/libgfortran/generated/transpose_i16.c @@ -60,7 +60,8 @@ transpose_i16 (gfc_array_i16 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_INTEGER_16)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_i4.c b/libgfortran/generated/transpose_i4.c index ba875303ab1..e6844fccbd9 100644 --- a/libgfortran/generated/transpose_i4.c +++ b/libgfortran/generated/transpose_i4.c @@ -60,7 +60,8 @@ transpose_i4 (gfc_array_i4 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_INTEGER_4)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_i8.c b/libgfortran/generated/transpose_i8.c index 5514f8039a6..df4a28af2b5 100644 --- a/libgfortran/generated/transpose_i8.c +++ b/libgfortran/generated/transpose_i8.c @@ -60,7 +60,8 @@ transpose_i8 (gfc_array_i8 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_INTEGER_8)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_r10.c b/libgfortran/generated/transpose_r10.c index a7b57065312..2ce05798b3d 100644 --- a/libgfortran/generated/transpose_r10.c +++ b/libgfortran/generated/transpose_r10.c @@ -60,7 +60,8 @@ transpose_r10 (gfc_array_r10 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_REAL_10)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_r16.c b/libgfortran/generated/transpose_r16.c index 3b9681acb23..5009d16cc13 100644 --- a/libgfortran/generated/transpose_r16.c +++ b/libgfortran/generated/transpose_r16.c @@ -60,7 +60,8 @@ transpose_r16 (gfc_array_r16 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_REAL_16)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_r4.c b/libgfortran/generated/transpose_r4.c index edf43cbbd07..71f70fcd9b0 100644 --- a/libgfortran/generated/transpose_r4.c +++ b/libgfortran/generated/transpose_r4.c @@ -60,7 +60,8 @@ transpose_r4 (gfc_array_r4 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_REAL_4)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_r8.c b/libgfortran/generated/transpose_r8.c index 852bcdb2eb2..9f541e0fb7e 100644 --- a/libgfortran/generated/transpose_r8.c +++ b/libgfortran/generated/transpose_r8.c @@ -60,7 +60,8 @@ transpose_r8 (gfc_array_r8 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_REAL_8)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/unpack_c10.c b/libgfortran/generated/unpack_c10.c index dcdb88d0943..6fc2bdc8796 100644 --- a/libgfortran/generated/unpack_c10.c +++ b/libgfortran/generated/unpack_c10.c @@ -99,7 +99,7 @@ unpack0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_10)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_10)); } else { @@ -244,7 +244,7 @@ unpack1_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_10)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_10)); } else { diff --git a/libgfortran/generated/unpack_c16.c b/libgfortran/generated/unpack_c16.c index e7a533111c8..443a51eea04 100644 --- a/libgfortran/generated/unpack_c16.c +++ b/libgfortran/generated/unpack_c16.c @@ -99,7 +99,7 @@ unpack0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_16)); } else { @@ -244,7 +244,7 @@ unpack1_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_16)); } else { diff --git a/libgfortran/generated/unpack_c4.c b/libgfortran/generated/unpack_c4.c index 927a4c34bc7..c8b30f5e6d6 100644 --- a/libgfortran/generated/unpack_c4.c +++ b/libgfortran/generated/unpack_c4.c @@ -99,7 +99,7 @@ unpack0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4)); } else { @@ -244,7 +244,7 @@ unpack1_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4)); } else { diff --git a/libgfortran/generated/unpack_c8.c b/libgfortran/generated/unpack_c8.c index f58a9876a58..60d9de1b650 100644 --- a/libgfortran/generated/unpack_c8.c +++ b/libgfortran/generated/unpack_c8.c @@ -99,7 +99,7 @@ unpack0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_8)); } else { @@ -244,7 +244,7 @@ unpack1_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_8)); } else { diff --git a/libgfortran/generated/unpack_i1.c b/libgfortran/generated/unpack_i1.c index d6c6ee32d1e..522ce74a9fd 100644 --- a/libgfortran/generated/unpack_i1.c +++ b/libgfortran/generated/unpack_i1.c @@ -99,7 +99,7 @@ unpack0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_1)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_1)); } else { @@ -244,7 +244,7 @@ unpack1_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_1)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/unpack_i16.c b/libgfortran/generated/unpack_i16.c index 2a59725397c..7e0d1f766d5 100644 --- a/libgfortran/generated/unpack_i16.c +++ b/libgfortran/generated/unpack_i16.c @@ -99,7 +99,7 @@ unpack0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_16)); } else { @@ -244,7 +244,7 @@ unpack1_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/unpack_i2.c b/libgfortran/generated/unpack_i2.c index 7aeca506640..b0d21dc246f 100644 --- a/libgfortran/generated/unpack_i2.c +++ b/libgfortran/generated/unpack_i2.c @@ -99,7 +99,7 @@ unpack0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_2)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_2)); } else { @@ -244,7 +244,7 @@ unpack1_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_2)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/unpack_i4.c b/libgfortran/generated/unpack_i4.c index 2a385ff13b1..beac1969a5d 100644 --- a/libgfortran/generated/unpack_i4.c +++ b/libgfortran/generated/unpack_i4.c @@ -99,7 +99,7 @@ unpack0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_4)); } else { @@ -244,7 +244,7 @@ unpack1_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/unpack_i8.c b/libgfortran/generated/unpack_i8.c index 399bd35a3bb..75cd2e93fe4 100644 --- a/libgfortran/generated/unpack_i8.c +++ b/libgfortran/generated/unpack_i8.c @@ -99,7 +99,7 @@ unpack0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_8)); } else { @@ -244,7 +244,7 @@ unpack1_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/unpack_r10.c b/libgfortran/generated/unpack_r10.c index 406395c4208..926a45777ae 100644 --- a/libgfortran/generated/unpack_r10.c +++ b/libgfortran/generated/unpack_r10.c @@ -99,7 +99,7 @@ unpack0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_10)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_10)); } else { @@ -244,7 +244,7 @@ unpack1_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_10)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_10)); } else { diff --git a/libgfortran/generated/unpack_r16.c b/libgfortran/generated/unpack_r16.c index 0f70e57c520..6fff184cdfa 100644 --- a/libgfortran/generated/unpack_r16.c +++ b/libgfortran/generated/unpack_r16.c @@ -99,7 +99,7 @@ unpack0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_16)); } else { @@ -244,7 +244,7 @@ unpack1_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_16)); } else { diff --git a/libgfortran/generated/unpack_r4.c b/libgfortran/generated/unpack_r4.c index 8b0dde1042a..c9008745f3a 100644 --- a/libgfortran/generated/unpack_r4.c +++ b/libgfortran/generated/unpack_r4.c @@ -99,7 +99,7 @@ unpack0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_4)); } else { @@ -244,7 +244,7 @@ unpack1_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_4)); } else { diff --git a/libgfortran/generated/unpack_r8.c b/libgfortran/generated/unpack_r8.c index 13e3540c643..5999a51ab68 100644 --- a/libgfortran/generated/unpack_r8.c +++ b/libgfortran/generated/unpack_r8.c @@ -99,7 +99,7 @@ unpack0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_8)); } else { @@ -244,7 +244,7 @@ unpack1_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_8)); } else { diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c index 12f8289274a..f983754f16a 100644 --- a/libgfortran/intrinsics/cshift0.c +++ b/libgfortran/intrinsics/cshift0.c @@ -79,8 +79,8 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c index 1857ab06578..7d372132012 100644 --- a/libgfortran/intrinsics/eoshift0.c +++ b/libgfortran/intrinsics/eoshift0.c @@ -86,8 +86,8 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array, } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c index ed264920ded..c7ec5cf9f84 100644 --- a/libgfortran/intrinsics/eoshift2.c +++ b/libgfortran/intrinsics/eoshift2.c @@ -78,8 +78,8 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array, ret->offset = 0; ret->dtype = array->dtype; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c index 9924223b39f..3fbfa0aaa03 100644 --- a/libgfortran/intrinsics/pack_generic.c +++ b/libgfortran/intrinsics/pack_generic.c @@ -152,8 +152,8 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array, GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, size); if (total == 0) return; /* In this case, nothing remains to be done. */ @@ -519,7 +519,7 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array, ret->offset = 0; - ret->base_addr = xmalloc (size * total); + ret->base_addr = xmallocarray (total, size); if (total == 0) return; diff --git a/libgfortran/intrinsics/reshape_generic.c b/libgfortran/intrinsics/reshape_generic.c index 3b2e9948789..f742051b5c8 100644 --- a/libgfortran/intrinsics/reshape_generic.c +++ b/libgfortran/intrinsics/reshape_generic.c @@ -99,11 +99,11 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; /* xmalloc will allocate 1 byte. */ else - alloc_size = rs * size; + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, size); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/intrinsics/spread_generic.c b/libgfortran/intrinsics/spread_generic.c index 0fe5722f15b..f3f23b8ce3b 100644 --- a/libgfortran/intrinsics/spread_generic.c +++ b/libgfortran/intrinsics/spread_generic.c @@ -100,7 +100,7 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source, GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; - ret->base_addr = xmalloc (rs * size); + ret->base_addr = xmallocarray (rs, size); if (rs <= 0) return; @@ -245,7 +245,7 @@ spread_internal_scalar (gfc_array_char *ret, const char *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * size); + ret->base_addr = xmallocarray (ncopies, size); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/intrinsics/string_intrinsics_inc.c b/libgfortran/intrinsics/string_intrinsics_inc.c index 84182af18b5..5c50366f35e 100644 --- a/libgfortran/intrinsics/string_intrinsics_inc.c +++ b/libgfortran/intrinsics/string_intrinsics_inc.c @@ -164,7 +164,7 @@ string_trim (gfc_charlen_type *len, CHARTYPE **dest, gfc_charlen_type slen, else { /* Allocate space for result string. */ - *dest = xmalloc (*len * sizeof (CHARTYPE)); + *dest = xmallocarray (*len, sizeof (CHARTYPE)); /* Copy string if necessary. */ memcpy (*dest, src, *len * sizeof (CHARTYPE)); @@ -442,7 +442,7 @@ string_minmax (gfc_charlen_type *rlen, CHARTYPE **dest, int op, int nargs, ...) *dest = &zero_length_string; else { - CHARTYPE *tmp = xmalloc (*rlen * sizeof (CHARTYPE)); + CHARTYPE *tmp = xmallocarray (*rlen, sizeof (CHARTYPE)); memcpy (tmp, res, reslen * sizeof (CHARTYPE)); MEMSET (&tmp[reslen], ' ', *rlen - reslen); *dest = tmp; diff --git a/libgfortran/intrinsics/transpose_generic.c b/libgfortran/intrinsics/transpose_generic.c index 5ee12ee10de..a5e2947a6cf 100644 --- a/libgfortran/intrinsics/transpose_generic.c +++ b/libgfortran/intrinsics/transpose_generic.c @@ -60,7 +60,7 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source) GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (size * size0 ((array_t*)ret)); + ret->base_addr = xmallocarray (size0 ((array_t*)ret), size); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c index 5d12cc11c9e..4bd99278edc 100644 --- a/libgfortran/intrinsics/unpack_generic.c +++ b/libgfortran/intrinsics/unpack_generic.c @@ -125,7 +125,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * size); + ret->base_addr = xmallocarray (rs, size); } else { diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index a7e4f888f1c..3b04bd2c17d 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2615,7 +2615,7 @@ nml_touch_nodes (namelist_info * nl) { index_type len = strlen (nl->var_name) + 1; int dim; - char * ext_name = (char*)xmalloc (len + 1); + char * ext_name = xmalloc (len + 1); memcpy (ext_name, nl->var_name, len-1); memcpy (ext_name + len - 1, "%", 2); for (nl = nl->next; nl; nl = nl->next) diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index cc0132c80f7..af2932c098d 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -3786,9 +3786,9 @@ st_set_nml_var (st_parameter_dt *dtp, void * var_addr, char * var_name, if (nml->var_rank > 0) { nml->dim = (descriptor_dimension*) - xmalloc (nml->var_rank * sizeof (descriptor_dimension)); + xmallocarray (nml->var_rank, sizeof (descriptor_dimension)); nml->ls = (array_loop_spec*) - xmalloc (nml->var_rank * sizeof (array_loop_spec)); + xmallocarray (nml->var_rank, sizeof (array_loop_spec)); } else { diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index a406c9e8be9..22b315a4fd3 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -454,7 +454,7 @@ get_internal_unit (st_parameter_dt *dtp) { iunit->rank = GFC_DESCRIPTOR_RANK (dtp->internal_unit_desc); iunit->ls = (array_loop_spec *) - xmalloc (iunit->rank * sizeof (array_loop_spec)); + xmallocarray (iunit->rank, sizeof (array_loop_spec)); dtp->internal_unit_len *= init_loop_spec (dtp->internal_unit_desc, iunit->ls, &start_record); diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index e17a3d86203..7818e0fb060 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1867,7 +1867,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset, base_var_name_len = base ? strlen (base->var_name) : 0; ext_name_len = base_name_len + base_var_name_len + strlen (obj->var_name) + obj->var_rank * NML_DIGITS + 1; - ext_name = (char*)xmalloc (ext_name_len); + ext_name = xmalloc (ext_name_len); memcpy (ext_name, base_name, base_name_len); clen = strlen (obj->var_name + base_var_name_len); @@ -1896,7 +1896,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset, /* Now obj_name. */ obj_name_len = strlen (obj->var_name) + 1; - obj_name = xmalloc (obj_name_len+1); + obj_name = xmalloc (obj_name_len + 1); memcpy (obj_name, obj->var_name, obj_name_len-1); memcpy (obj_name + obj_name_len-1, "%", 2); diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index b3e8a2e7cfd..c8c09f6910c 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -768,6 +768,9 @@ internal_proto(get_fpu_rounding_mode); extern void *xmalloc (size_t) __attribute__ ((malloc)); internal_proto(xmalloc); +extern void *xmallocarray (size_t, size_t) __attribute__ ((malloc)); +internal_proto(xmallocarray); + extern void *xcalloc (size_t, size_t) __attribute__ ((malloc)); internal_proto(xcalloc); diff --git a/libgfortran/m4/bessel.m4 b/libgfortran/m4/bessel.m4 index 15127e55832..36ffd335688 100644 --- a/libgfortran/m4/bessel.m4 +++ b/libgfortran/m4/bessel.m4 @@ -56,7 +56,7 @@ bessel_jn_r'rtype_kind` ('rtype` * const restrict ret, int n1, int n2, 'rtype_na { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof ('rtype_name`) * size); + ret->base_addr = xmallocarray (size, sizeof ('rtype_name`)); ret->offset = 0; } @@ -123,7 +123,7 @@ bessel_yn_r'rtype_kind` ('rtype` * const restrict ret, int n1, int n2, { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof ('rtype_name`) * size); + ret->base_addr = xmallocarray (size, sizeof ('rtype_name`)); ret->offset = 0; } diff --git a/libgfortran/m4/cshift1.m4 b/libgfortran/m4/cshift1.m4 index 602bf9edb0d..e743e9e90d5 100644 --- a/libgfortran/m4/cshift1.m4 +++ b/libgfortran/m4/cshift1.m4 @@ -81,7 +81,7 @@ cshift1 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) diff --git a/libgfortran/m4/eoshift1.m4 b/libgfortran/m4/eoshift1.m4 index c373afe4b6b..df785ecdc20 100644 --- a/libgfortran/m4/eoshift1.m4 +++ b/libgfortran/m4/eoshift1.m4 @@ -106,8 +106,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4 index f1997df36ec..1a257d98f3c 100644 --- a/libgfortran/m4/eoshift3.m4 +++ b/libgfortran/m4/eoshift3.m4 @@ -90,7 +90,7 @@ eoshift3 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) @@ -108,8 +108,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/m4/iforeach.m4 b/libgfortran/m4/iforeach.m4 index a875a2ac273..2b916af66dd 100644 --- a/libgfortran/m4/iforeach.m4 +++ b/libgfortran/m4/iforeach.m4 @@ -30,7 +30,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (rtype_name) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (rtype_name)); } else { @@ -133,7 +133,7 @@ void GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (rtype_name) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (rtype_name)); } else { @@ -264,7 +264,7 @@ void GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (rtype_name) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (rtype_name)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4 index 1555aebbc4a..b4de9a87608 100644 --- a/libgfortran/m4/ifunction.m4 +++ b/libgfortran/m4/ifunction.m4 @@ -85,10 +85,9 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -260,8 +259,7 @@ void } - alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -273,7 +271,7 @@ void return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); } else @@ -417,8 +415,7 @@ void retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -427,7 +424,7 @@ void return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); } else { diff --git a/libgfortran/m4/ifunction_logical.m4 b/libgfortran/m4/ifunction_logical.m4 index 13dd7a928f3..fd3afb074f8 100644 --- a/libgfortran/m4/ifunction_logical.m4 +++ b/libgfortran/m4/ifunction_logical.m4 @@ -89,8 +89,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -99,7 +98,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); } else { diff --git a/libgfortran/m4/in_pack.m4 b/libgfortran/m4/in_pack.m4 index 9d515d42b51..a807e71e5a6 100644 --- a/libgfortran/m4/in_pack.m4 +++ b/libgfortran/m4/in_pack.m4 @@ -79,7 +79,7 @@ internal_pack_'rtype_ccode` ('rtype` * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = ('rtype_name` *)xmalloc (ssize * sizeof ('rtype_name`)); + destptr = xmallocarray (ssize, sizeof ('rtype_name`)); dest = destptr; src = source->base_addr; stride0 = stride[0]; diff --git a/libgfortran/m4/matmul.m4 b/libgfortran/m4/matmul.m4 index 937daa829a4..e5f43e2d641 100644 --- a/libgfortran/m4/matmul.m4 +++ b/libgfortran/m4/matmul.m4 @@ -125,7 +125,7 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof ('rtype_name`)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/m4/matmull.m4 b/libgfortran/m4/matmull.m4 index 25bdc75b955..4be37d5a86c 100644 --- a/libgfortran/m4/matmull.m4 +++ b/libgfortran/m4/matmull.m4 @@ -89,7 +89,7 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof ('rtype_name`)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/m4/pack.m4 b/libgfortran/m4/pack.m4 index 8495de4efca..a5517d07b30 100644 --- a/libgfortran/m4/pack.m4 +++ b/libgfortran/m4/pack.m4 @@ -168,8 +168,8 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array, ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (sizeof ('rtype_name`) * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, sizeof ('rtype_name`)); if (total == 0) return; diff --git a/libgfortran/m4/reshape.m4 b/libgfortran/m4/reshape.m4 index 943f3e93653..6341b6e9a2c 100644 --- a/libgfortran/m4/reshape.m4 +++ b/libgfortran/m4/reshape.m4 @@ -115,11 +115,11 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; else - alloc_size = rs * sizeof ('rtype_name`); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof ('rtype_name`)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/m4/shape.m4 b/libgfortran/m4/shape.m4 index 85dd233d1ca..9d02c6c4029 100644 --- a/libgfortran/m4/shape.m4 +++ b/libgfortran/m4/shape.m4 @@ -50,7 +50,7 @@ shape_'rtype_kind` ('rtype` * const restrict ret, { GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1); ret->offset = 0; - ret->base_addr = xmalloc (sizeof ('rtype_name`) * rank); + ret->base_addr = xmallocarray (rank, sizeof ('rtype_name`)); } stride = GFC_DESCRIPTOR_STRIDE(ret,0); diff --git a/libgfortran/m4/spread.m4 b/libgfortran/m4/spread.m4 index 82ae240e17d..62cfd81dea6 100644 --- a/libgfortran/m4/spread.m4 +++ b/libgfortran/m4/spread.m4 @@ -102,8 +102,8 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof('rtype_name`)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof('rtype_name`)); if (rs <= 0) return; } @@ -245,7 +245,7 @@ spread_scalar_'rtype_code` ('rtype` *ret, const 'rtype_name` *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof ('rtype_name`)); + ret->base_addr = xmallocarray (ncopies, sizeof ('rtype_name`)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/m4/transpose.m4 b/libgfortran/m4/transpose.m4 index da4f782b013..6d9f4764c30 100644 --- a/libgfortran/m4/transpose.m4 +++ b/libgfortran/m4/transpose.m4 @@ -61,7 +61,8 @@ transpose_'rtype_code` ('rtype` * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof ('rtype_name`)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/m4/unpack.m4 b/libgfortran/m4/unpack.m4 index 4382ac425c4..e945446d804 100644 --- a/libgfortran/m4/unpack.m4 +++ b/libgfortran/m4/unpack.m4 @@ -100,7 +100,7 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof ('rtype_name`)); + ret->base_addr = xmallocarray (rs, sizeof ('rtype_name`)); } else { @@ -245,7 +245,7 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof ('rtype_name`)); + ret->base_addr = xmallocarray (rs, sizeof ('rtype_name`)); } else { diff --git a/libgfortran/runtime/convert_char.c b/libgfortran/runtime/convert_char.c index aa819912a13..c3cd1c28c16 100644 --- a/libgfortran/runtime/convert_char.c +++ b/libgfortran/runtime/convert_char.c @@ -44,7 +44,7 @@ convert_char1_to_char4 (gfc_char4_t **dst, gfc_charlen_type len, gfc_charlen_type i, l; l = len > 0 ? len : 0; - *dst = xmalloc ((l + 1) * sizeof (gfc_char4_t)); + *dst = xmallocarray ((l + 1), sizeof (gfc_char4_t)); for (i = 0; i < l; i++) (*dst)[i] = src[i]; @@ -60,7 +60,7 @@ convert_char4_to_char1 (unsigned char **dst, gfc_charlen_type len, gfc_charlen_type i, l; l = len > 0 ? len : 0; - *dst = xmalloc ((l + 1) * sizeof (unsigned char)); + *dst = xmalloc (l + 1); for (i = 0; i < l; i++) (*dst)[i] = src[i]; diff --git a/libgfortran/runtime/environ.c b/libgfortran/runtime/environ.c index 0c0e9308fb4..1095f443a5f 100644 --- a/libgfortran/runtime/environ.c +++ b/libgfortran/runtime/environ.c @@ -837,7 +837,7 @@ void init_unformatted (variable * v) } else { - elist = xmalloc (unit_count * sizeof (exception_t)); + elist = xmallocarray (unit_count, sizeof (exception_t)); do_count = 0; p = val; do_parse (); diff --git a/libgfortran/runtime/in_pack_generic.c b/libgfortran/runtime/in_pack_generic.c index 1b8c5584384..aab155df683 100644 --- a/libgfortran/runtime/in_pack_generic.c +++ b/libgfortran/runtime/in_pack_generic.c @@ -180,7 +180,7 @@ internal_pack (gfc_array_char * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = xmalloc (ssize * size); + destptr = xmallocarray (ssize, size); dest = (char *)destptr; src = source->base_addr; stride0 = stride[0] * size; diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c index b18b50532c7..501d870b83c 100644 --- a/libgfortran/runtime/memory.c +++ b/libgfortran/runtime/memory.c @@ -25,6 +25,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "libgfortran.h" #include <stdlib.h> +#include <errno.h> + +#ifndef SIZE_MAX +#define SIZE_MAX ((size_t)-1) +#endif void * @@ -44,12 +49,34 @@ xmalloc (size_t n) } +void * +xmallocarray (size_t nmemb, size_t size) +{ + void *p; + + if (!nmemb || !size) + size = nmemb = 1; + else if (nmemb > SIZE_MAX / size) + { + errno = ENOMEM; + os_error ("Integer overflow in xmallocarray"); + } + + p = malloc (nmemb * size); + + if (!p) + os_error ("Memory allocation failed in xmallocarray"); + + return p; +} + + /* calloc wrapper that aborts on error. */ void * xcalloc (size_t nmemb, size_t size) { - if (nmemb * size == 0) + if (!nmemb || !size) nmemb = size = 1; void *p = calloc (nmemb, size); |