aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libgfortran/m4
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/libgfortran/m4')
-rw-r--r--gcc-4.9/libgfortran/m4/bessel.m44
-rw-r--r--gcc-4.9/libgfortran/m4/cshift1.m42
-rw-r--r--gcc-4.9/libgfortran/m4/eoshift1.m44
-rw-r--r--gcc-4.9/libgfortran/m4/eoshift3.m46
-rw-r--r--gcc-4.9/libgfortran/m4/iforeach.m46
-rw-r--r--gcc-4.9/libgfortran/m4/ifunction.m415
-rw-r--r--gcc-4.9/libgfortran/m4/ifunction_logical.m45
-rw-r--r--gcc-4.9/libgfortran/m4/in_pack.m42
-rw-r--r--gcc-4.9/libgfortran/m4/matmul.m42
-rw-r--r--gcc-4.9/libgfortran/m4/matmull.m42
-rw-r--r--gcc-4.9/libgfortran/m4/pack.m44
-rw-r--r--gcc-4.9/libgfortran/m4/reshape.m46
-rw-r--r--gcc-4.9/libgfortran/m4/shape.m42
-rw-r--r--gcc-4.9/libgfortran/m4/spread.m46
-rw-r--r--gcc-4.9/libgfortran/m4/transpose.m43
-rw-r--r--gcc-4.9/libgfortran/m4/unpack.m44
16 files changed, 35 insertions, 38 deletions
diff --git a/gcc-4.9/libgfortran/m4/bessel.m4 b/gcc-4.9/libgfortran/m4/bessel.m4
index 15127e558..36ffd3356 100644
--- a/gcc-4.9/libgfortran/m4/bessel.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/cshift1.m4 b/gcc-4.9/libgfortran/m4/cshift1.m4
index 602bf9edb..e743e9e90 100644
--- a/gcc-4.9/libgfortran/m4/cshift1.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/eoshift1.m4 b/gcc-4.9/libgfortran/m4/eoshift1.m4
index c373afe4b..df785ecdc 100644
--- a/gcc-4.9/libgfortran/m4/eoshift1.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/eoshift3.m4 b/gcc-4.9/libgfortran/m4/eoshift3.m4
index f1997df36..1a257d98f 100644
--- a/gcc-4.9/libgfortran/m4/eoshift3.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/iforeach.m4 b/gcc-4.9/libgfortran/m4/iforeach.m4
index a875a2ac2..2b916af66 100644
--- a/gcc-4.9/libgfortran/m4/iforeach.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/ifunction.m4 b/gcc-4.9/libgfortran/m4/ifunction.m4
index 1555aebbc..b4de9a876 100644
--- a/gcc-4.9/libgfortran/m4/ifunction.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/ifunction_logical.m4 b/gcc-4.9/libgfortran/m4/ifunction_logical.m4
index 13dd7a928..fd3afb074 100644
--- a/gcc-4.9/libgfortran/m4/ifunction_logical.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/in_pack.m4 b/gcc-4.9/libgfortran/m4/in_pack.m4
index 9d515d42b..a807e71e5 100644
--- a/gcc-4.9/libgfortran/m4/in_pack.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/matmul.m4 b/gcc-4.9/libgfortran/m4/matmul.m4
index 937daa829..e5f43e2d6 100644
--- a/gcc-4.9/libgfortran/m4/matmul.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/matmull.m4 b/gcc-4.9/libgfortran/m4/matmull.m4
index 25bdc75b9..4be37d5a8 100644
--- a/gcc-4.9/libgfortran/m4/matmull.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/pack.m4 b/gcc-4.9/libgfortran/m4/pack.m4
index 8495de4ef..a5517d07b 100644
--- a/gcc-4.9/libgfortran/m4/pack.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/reshape.m4 b/gcc-4.9/libgfortran/m4/reshape.m4
index 943f3e936..6341b6e9a 100644
--- a/gcc-4.9/libgfortran/m4/reshape.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/shape.m4 b/gcc-4.9/libgfortran/m4/shape.m4
index 85dd233d1..9d02c6c40 100644
--- a/gcc-4.9/libgfortran/m4/shape.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/spread.m4 b/gcc-4.9/libgfortran/m4/spread.m4
index 82ae240e1..62cfd81de 100644
--- a/gcc-4.9/libgfortran/m4/spread.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/transpose.m4 b/gcc-4.9/libgfortran/m4/transpose.m4
index da4f782b0..6d9f4764c 100644
--- a/gcc-4.9/libgfortran/m4/transpose.m4
+++ b/gcc-4.9/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/gcc-4.9/libgfortran/m4/unpack.m4 b/gcc-4.9/libgfortran/m4/unpack.m4
index 4382ac425..e945446d8 100644
--- a/gcc-4.9/libgfortran/m4/unpack.m4
+++ b/gcc-4.9/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
{