mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-19 19:04:11 +08:00
memory.c (internal_malloc_size): If size is zero, allocate a single byte.
2011-07-05 Thomas Koenig <tkoenig@gcc.gnu.org> * runtime/memory.c (internal_malloc_size): If size is zero, allocate a single byte. * m4/pack.m4 (pack_'rtype_code`): Don't check for zero size for the argument of internal_malloc_size. * m4/spread.m4 (spread_'rtype_code`): Likewise. * m4/eoshift1.m4 (eoshift1): Don't allocate twice. Don't check for zero size for the argument of internal_malloc_size. * m4/eoshift3.m4: Don't check for zero size for the argument of internal_malloc_size. * intrinsics/pack_generic.c (pack_internal): Likewise. (pack_s_internal): Likewise. * intrinsics/cshift0.c (cshift0): Likewise. * intrinsics/spread_generic.c (spread_internal): Likewise. * intrinsics/eoshift0.c (eoshift0): Likewise. * intrinsics/eoshift2.c (eoshift2): Likewise. * generated/eoshift1_16.c: Regenerated. * generated/eoshift1_4.c: Regenerated. * generated/eoshift1_8.c: Regenerated. * generated/eoshift3_16.c: Regenerated. * generated/eoshift3_4.c: Regenerated. * generated/eoshift3_8.c: Regenerated. * generated/pack_c10.c: Regenerated. * generated/pack_c16.c: Regenerated. * generated/pack_c4.c: Regenerated. * generated/pack_c8.c: Regenerated. * generated/pack_i16.c: Regenerated. * generated/pack_i1.c: Regenerated. * generated/pack_i2.c: Regenerated. * generated/pack_i4.c: Regenerated. * generated/pack_i8.c: Regenerated. * generated/pack_r10.c: Regenerated. * generated/pack_r16.c: Regenerated. * generated/pack_r4.c: Regenerated. * generated/pack_r8.c: Regenerated. * generated/spread_c10.c: Regenerated. * generated/spread_c16.c: Regenerated. * generated/spread_c4.c: Regenerated. * generated/spread_c8.c: Regenerated. * generated/spread_i16.c: Regenerated. * generated/spread_i1.c: Regenerated. * generated/spread_i2.c: Regenerated. * generated/spread_i4.c: Regenerated. * generated/spread_i8.c: Regenerated. * generated/spread_r10.c: Regenerated. * generated/spread_r16.c: Regenerated. * generated/spread_r4.c: Regenerated. * generated/spread_r8.c: Regenerated. From-SVN: r175880
This commit is contained in:
parent
3c428fb333
commit
a787f6f9ec
@ -1,3 +1,53 @@
|
||||
2011-07-05 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
|
||||
* runtime/memory.c (internal_malloc_size): If size is zero,
|
||||
allocate a single byte.
|
||||
* m4/pack.m4 (pack_'rtype_code`): Don't check for zero size
|
||||
for the argument of internal_malloc_size.
|
||||
* m4/spread.m4 (spread_'rtype_code`): Likewise.
|
||||
* m4/eoshift1.m4 (eoshift1): Don't allocate twice. Don't check
|
||||
for zero size for the argument of internal_malloc_size.
|
||||
* m4/eoshift3.m4: Don't check for zero size for the argument of
|
||||
internal_malloc_size.
|
||||
* intrinsics/pack_generic.c (pack_internal): Likewise.
|
||||
(pack_s_internal): Likewise.
|
||||
* intrinsics/cshift0.c (cshift0): Likewise.
|
||||
* intrinsics/spread_generic.c (spread_internal): Likewise.
|
||||
* intrinsics/eoshift0.c (eoshift0): Likewise.
|
||||
* intrinsics/eoshift2.c (eoshift2): Likewise.
|
||||
* generated/eoshift1_16.c: Regenerated.
|
||||
* generated/eoshift1_4.c: Regenerated.
|
||||
* generated/eoshift1_8.c: Regenerated.
|
||||
* generated/eoshift3_16.c: Regenerated.
|
||||
* generated/eoshift3_4.c: Regenerated.
|
||||
* generated/eoshift3_8.c: Regenerated.
|
||||
* generated/pack_c10.c: Regenerated.
|
||||
* generated/pack_c16.c: Regenerated.
|
||||
* generated/pack_c4.c: Regenerated.
|
||||
* generated/pack_c8.c: Regenerated.
|
||||
* generated/pack_i16.c: Regenerated.
|
||||
* generated/pack_i1.c: Regenerated.
|
||||
* generated/pack_i2.c: Regenerated.
|
||||
* generated/pack_i4.c: Regenerated.
|
||||
* generated/pack_i8.c: Regenerated.
|
||||
* generated/pack_r10.c: Regenerated.
|
||||
* generated/pack_r16.c: Regenerated.
|
||||
* generated/pack_r4.c: Regenerated.
|
||||
* generated/pack_r8.c: Regenerated.
|
||||
* generated/spread_c10.c: Regenerated.
|
||||
* generated/spread_c16.c: Regenerated.
|
||||
* generated/spread_c4.c: Regenerated.
|
||||
* generated/spread_c8.c: Regenerated.
|
||||
* generated/spread_i16.c: Regenerated.
|
||||
* generated/spread_i1.c: Regenerated.
|
||||
* generated/spread_i2.c: Regenerated.
|
||||
* generated/spread_i4.c: Regenerated.
|
||||
* generated/spread_i8.c: Regenerated.
|
||||
* generated/spread_r10.c: Regenerated.
|
||||
* generated/spread_r16.c: Regenerated.
|
||||
* generated/spread_r4.c: Regenerated.
|
||||
* generated/spread_r8.c: Regenerated.
|
||||
|
||||
2011-06-28 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
|
||||
PR fortran/49479
|
||||
|
@ -88,7 +88,6 @@ eoshift1 (gfc_array_char * const restrict ret,
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
ret->offset = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
@ -106,10 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret,
|
||||
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
|
||||
|
||||
}
|
||||
if (arraysize > 0)
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
else
|
||||
ret->data = internal_malloc_size (1);
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
|
||||
}
|
||||
else if (unlikely (compile_options.bounds_check))
|
||||
|
@ -88,7 +88,6 @@ eoshift1 (gfc_array_char * const restrict ret,
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
ret->offset = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
@ -106,10 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret,
|
||||
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
|
||||
|
||||
}
|
||||
if (arraysize > 0)
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
else
|
||||
ret->data = internal_malloc_size (1);
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
|
||||
}
|
||||
else if (unlikely (compile_options.bounds_check))
|
||||
|
@ -88,7 +88,6 @@ eoshift1 (gfc_array_char * const restrict ret,
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
ret->offset = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
@ -106,10 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret,
|
||||
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
|
||||
|
||||
}
|
||||
if (arraysize > 0)
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
else
|
||||
ret->data = internal_malloc_size (1);
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
|
||||
}
|
||||
else if (unlikely (compile_options.bounds_check))
|
||||
|
@ -107,10 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret,
|
||||
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
|
||||
|
||||
}
|
||||
if (arraysize > 0)
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
else
|
||||
ret->data = internal_malloc_size (1);
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
|
||||
}
|
||||
else if (unlikely (compile_options.bounds_check))
|
||||
|
@ -107,10 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret,
|
||||
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
|
||||
|
||||
}
|
||||
if (arraysize > 0)
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
else
|
||||
ret->data = internal_malloc_size (1);
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
|
||||
}
|
||||
else if (unlikely (compile_options.bounds_check))
|
||||
|
@ -107,10 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret,
|
||||
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
|
||||
|
||||
}
|
||||
if (arraysize > 0)
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
else
|
||||
ret->data = internal_malloc_size (1);
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
|
||||
}
|
||||
else if (unlikely (compile_options.bounds_check))
|
||||
|
@ -166,14 +166,12 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_10) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_10) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_16) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_16) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_4) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_4) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_8) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_8) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_INTEGER_1) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_INTEGER_1) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_INTEGER_2) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_INTEGER_2) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_REAL_10) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_REAL_10) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_REAL_16) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_REAL_16) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_REAL_4) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_REAL_4) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,14 +166,12 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof (GFC_REAL_8) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof (GFC_REAL_8) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_c10 (gfc_array_c10 *ret, const gfc_array_c10 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_COMPLEX_10));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_COMPLEX_10));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_c16 (gfc_array_c16 *ret, const gfc_array_c16 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_COMPLEX_16));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_COMPLEX_16));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_c4 (gfc_array_c4 *ret, const gfc_array_c4 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_COMPLEX_4));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_COMPLEX_4));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_c8 (gfc_array_c8 *ret, const gfc_array_c8 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_COMPLEX_8));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_COMPLEX_8));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_i1 (gfc_array_i1 *ret, const gfc_array_i1 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_INTEGER_1));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_INTEGER_1));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_INTEGER_16));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_INTEGER_16));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_i2 (gfc_array_i2 *ret, const gfc_array_i2 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_INTEGER_2));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_INTEGER_2));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_i4 (gfc_array_i4 *ret, const gfc_array_i4 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_INTEGER_4));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_INTEGER_4));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_i8 (gfc_array_i8 *ret, const gfc_array_i8 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_INTEGER_8));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_INTEGER_8));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_r10 (gfc_array_r10 *ret, const gfc_array_r10 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_REAL_10));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_REAL_10));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_r16 (gfc_array_r16 *ret, const gfc_array_r16 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_REAL_16));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_REAL_16));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_r4 (gfc_array_r4 *ret, const gfc_array_r4 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_REAL_4));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_REAL_4));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -100,13 +100,11 @@ spread_r8 (gfc_array_r8 *ret, const gfc_array_r8 *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_REAL_8));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof(GFC_REAL_8));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -79,10 +79,8 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
|
||||
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
|
||||
}
|
||||
|
||||
if (arraysize > 0)
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
else
|
||||
ret->data = internal_malloc_size (1);
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
}
|
||||
else if (unlikely (compile_options.bounds_check))
|
||||
{
|
||||
|
@ -86,11 +86,8 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
|
||||
|
||||
}
|
||||
|
||||
if (arraysize > 0)
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
else
|
||||
ret->data = internal_malloc_size (1);
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
}
|
||||
else if (unlikely (compile_options.bounds_check))
|
||||
{
|
||||
|
@ -91,10 +91,8 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
|
||||
|
||||
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
|
||||
|
||||
if (arraysize > 0)
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
else
|
||||
ret->data = internal_malloc_size (1);
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -153,14 +153,11 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (size * total);
|
||||
return; /* In this case, nothing remains to be done. */
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -523,13 +520,10 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
ret->data = internal_malloc_size (size * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (size * total);
|
||||
return;
|
||||
}
|
||||
|
||||
rstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(ret,0);
|
||||
|
@ -100,13 +100,10 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * size);
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
ret->data = internal_malloc_size (rs * size);
|
||||
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -89,7 +89,6 @@ eoshift1 (gfc_array_char * const restrict ret,
|
||||
{
|
||||
int i;
|
||||
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
ret->offset = 0;
|
||||
ret->dtype = array->dtype;
|
||||
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
|
||||
@ -107,10 +106,8 @@ eoshift1 (gfc_array_char * const restrict ret,
|
||||
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
|
||||
|
||||
}
|
||||
if (arraysize > 0)
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
else
|
||||
ret->data = internal_malloc_size (1);
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
|
||||
}
|
||||
else if (unlikely (compile_options.bounds_check))
|
||||
|
@ -108,10 +108,8 @@ eoshift3 (gfc_array_char * const restrict ret,
|
||||
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
|
||||
|
||||
}
|
||||
if (arraysize > 0)
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
else
|
||||
ret->data = internal_malloc_size (1);
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (size * arraysize);
|
||||
|
||||
}
|
||||
else if (unlikely (compile_options.bounds_check))
|
||||
|
@ -167,14 +167,12 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array,
|
||||
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
|
||||
|
||||
ret->offset = 0;
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (sizeof ('rtype_name`) * total);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
/* In this case, nothing remains to be done. */
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
ret->data = internal_malloc_size (sizeof ('rtype_name`) * total);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -101,13 +101,11 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source,
|
||||
GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
|
||||
}
|
||||
ret->offset = 0;
|
||||
if (rs > 0)
|
||||
ret->data = internal_malloc_size (rs * sizeof('rtype_name`));
|
||||
else
|
||||
{
|
||||
ret->data = internal_malloc_size (1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* internal_malloc_size allocates a single byte for zero size. */
|
||||
ret->data = internal_malloc_size (rs * sizeof('rtype_name`));
|
||||
if (rs <= 0)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -54,8 +54,8 @@ get_mem (size_t n)
|
||||
void *
|
||||
internal_malloc_size (size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return NULL;
|
||||
if (unlikely (size == 0))
|
||||
size = 1;
|
||||
|
||||
return get_mem (size);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user