summaryrefslogtreecommitdiff
path: root/libgfortran/generated
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-05 18:16:17 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-05 18:16:17 +0000
commit0248e4c1015d8dc69c0638b1b785958e703e2d0c (patch)
tree39e9a0538999ccc19813d9e4c1132c8912803e5a /libgfortran/generated
parentf1bd80958b3cdb8ac354e00a6f9bd3b9773da788 (diff)
downloadlinaro-gcc-0248e4c1015d8dc69c0638b1b785958e703e2d0c.tar.gz
linaro-gcc-0248e4c1015d8dc69c0638b1b785958e703e2d0c.tar.bz2
linaro-gcc-0248e4c1015d8dc69c0638b1b785958e703e2d0c.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175880 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/generated')
-rw-r--r--libgfortran/generated/eoshift1_16.c7
-rw-r--r--libgfortran/generated/eoshift1_4.c7
-rw-r--r--libgfortran/generated/eoshift1_8.c7
-rw-r--r--libgfortran/generated/eoshift3_16.c6
-rw-r--r--libgfortran/generated/eoshift3_4.c6
-rw-r--r--libgfortran/generated/eoshift3_8.c6
-rw-r--r--libgfortran/generated/pack_c10.c12
-rw-r--r--libgfortran/generated/pack_c16.c12
-rw-r--r--libgfortran/generated/pack_c4.c12
-rw-r--r--libgfortran/generated/pack_c8.c12
-rw-r--r--libgfortran/generated/pack_i1.c12
-rw-r--r--libgfortran/generated/pack_i16.c12
-rw-r--r--libgfortran/generated/pack_i2.c12
-rw-r--r--libgfortran/generated/pack_i4.c12
-rw-r--r--libgfortran/generated/pack_i8.c12
-rw-r--r--libgfortran/generated/pack_r10.c12
-rw-r--r--libgfortran/generated/pack_r16.c12
-rw-r--r--libgfortran/generated/pack_r4.c12
-rw-r--r--libgfortran/generated/pack_r8.c12
-rw-r--r--libgfortran/generated/spread_c10.c12
-rw-r--r--libgfortran/generated/spread_c16.c12
-rw-r--r--libgfortran/generated/spread_c4.c12
-rw-r--r--libgfortran/generated/spread_c8.c12
-rw-r--r--libgfortran/generated/spread_i1.c12
-rw-r--r--libgfortran/generated/spread_i16.c12
-rw-r--r--libgfortran/generated/spread_i2.c12
-rw-r--r--libgfortran/generated/spread_i4.c12
-rw-r--r--libgfortran/generated/spread_i8.c12
-rw-r--r--libgfortran/generated/spread_r10.c12
-rw-r--r--libgfortran/generated/spread_r16.c12
-rw-r--r--libgfortran/generated/spread_r4.c12
-rw-r--r--libgfortran/generated/spread_r8.c12
32 files changed, 142 insertions, 209 deletions
diff --git a/libgfortran/generated/eoshift1_16.c b/libgfortran/generated/eoshift1_16.c
index a14bd292715..eb3a27a1c64 100644
--- a/libgfortran/generated/eoshift1_16.c
+++ b/libgfortran/generated/eoshift1_16.c
@@ -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))
diff --git a/libgfortran/generated/eoshift1_4.c b/libgfortran/generated/eoshift1_4.c
index 06bc309c4a8..d3776b911b0 100644
--- a/libgfortran/generated/eoshift1_4.c
+++ b/libgfortran/generated/eoshift1_4.c
@@ -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))
diff --git a/libgfortran/generated/eoshift1_8.c b/libgfortran/generated/eoshift1_8.c
index 3e9162d0f08..5f026acdfcb 100644
--- a/libgfortran/generated/eoshift1_8.c
+++ b/libgfortran/generated/eoshift1_8.c
@@ -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))
diff --git a/libgfortran/generated/eoshift3_16.c b/libgfortran/generated/eoshift3_16.c
index ec21d1ec14d..1cf216767ac 100644
--- a/libgfortran/generated/eoshift3_16.c
+++ b/libgfortran/generated/eoshift3_16.c
@@ -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))
diff --git a/libgfortran/generated/eoshift3_4.c b/libgfortran/generated/eoshift3_4.c
index ce4cede1f1d..c6033d0a58a 100644
--- a/libgfortran/generated/eoshift3_4.c
+++ b/libgfortran/generated/eoshift3_4.c
@@ -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))
diff --git a/libgfortran/generated/eoshift3_8.c b/libgfortran/generated/eoshift3_8.c
index 4af36f72bb4..7a7b196eec4 100644
--- a/libgfortran/generated/eoshift3_8.c
+++ b/libgfortran/generated/eoshift3_8.c
@@ -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))
diff --git a/libgfortran/generated/pack_c10.c b/libgfortran/generated/pack_c10.c
index cc66c538e1c..621ba8d8b79 100644
--- a/libgfortran/generated/pack_c10.c
+++ b/libgfortran/generated/pack_c10.c
@@ -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
{
diff --git a/libgfortran/generated/pack_c16.c b/libgfortran/generated/pack_c16.c
index 9397262dd06..e98de98c91c 100644
--- a/libgfortran/generated/pack_c16.c
+++ b/libgfortran/generated/pack_c16.c
@@ -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
{
diff --git a/libgfortran/generated/pack_c4.c b/libgfortran/generated/pack_c4.c
index 093bdcc9a1d..85e15417851 100644
--- a/libgfortran/generated/pack_c4.c
+++ b/libgfortran/generated/pack_c4.c
@@ -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
{
diff --git a/libgfortran/generated/pack_c8.c b/libgfortran/generated/pack_c8.c
index 7971e2ba135..bfaec2fc910 100644
--- a/libgfortran/generated/pack_c8.c
+++ b/libgfortran/generated/pack_c8.c
@@ -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
{
diff --git a/libgfortran/generated/pack_i1.c b/libgfortran/generated/pack_i1.c
index 3e4647dbd55..c168affaea0 100644
--- a/libgfortran/generated/pack_i1.c
+++ b/libgfortran/generated/pack_i1.c
@@ -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
{
diff --git a/libgfortran/generated/pack_i16.c b/libgfortran/generated/pack_i16.c
index 99d3491c38f..81ed49a8208 100644
--- a/libgfortran/generated/pack_i16.c
+++ b/libgfortran/generated/pack_i16.c
@@ -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
{
diff --git a/libgfortran/generated/pack_i2.c b/libgfortran/generated/pack_i2.c
index e796d169f76..a04b7af6969 100644
--- a/libgfortran/generated/pack_i2.c
+++ b/libgfortran/generated/pack_i2.c
@@ -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
{
diff --git a/libgfortran/generated/pack_i4.c b/libgfortran/generated/pack_i4.c
index 91ce99fe4fd..c5d112bd394 100644
--- a/libgfortran/generated/pack_i4.c
+++ b/libgfortran/generated/pack_i4.c
@@ -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
{
diff --git a/libgfortran/generated/pack_i8.c b/libgfortran/generated/pack_i8.c
index e49d8c29e95..7307192749b 100644
--- a/libgfortran/generated/pack_i8.c
+++ b/libgfortran/generated/pack_i8.c
@@ -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
{
diff --git a/libgfortran/generated/pack_r10.c b/libgfortran/generated/pack_r10.c
index f70c932640e..c3b55cc1a9f 100644
--- a/libgfortran/generated/pack_r10.c
+++ b/libgfortran/generated/pack_r10.c
@@ -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
{
diff --git a/libgfortran/generated/pack_r16.c b/libgfortran/generated/pack_r16.c
index ff2ad6e7eed..489ff957aa1 100644
--- a/libgfortran/generated/pack_r16.c
+++ b/libgfortran/generated/pack_r16.c
@@ -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
{
diff --git a/libgfortran/generated/pack_r4.c b/libgfortran/generated/pack_r4.c
index 0c08b8c8c94..05172dbbb06 100644
--- a/libgfortran/generated/pack_r4.c
+++ b/libgfortran/generated/pack_r4.c
@@ -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
{
diff --git a/libgfortran/generated/pack_r8.c b/libgfortran/generated/pack_r8.c
index 2b307e29a2b..df5cc3f3a6e 100644
--- a/libgfortran/generated/pack_r8.c
+++ b/libgfortran/generated/pack_r8.c
@@ -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
{
diff --git a/libgfortran/generated/spread_c10.c b/libgfortran/generated/spread_c10.c
index 77a838f01a4..d8a5bafe235 100644
--- a/libgfortran/generated/spread_c10.c
+++ b/libgfortran/generated/spread_c10.c
@@ -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
{
diff --git a/libgfortran/generated/spread_c16.c b/libgfortran/generated/spread_c16.c
index 1276e4dfb44..0bfba7f4145 100644
--- a/libgfortran/generated/spread_c16.c
+++ b/libgfortran/generated/spread_c16.c
@@ -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
{
diff --git a/libgfortran/generated/spread_c4.c b/libgfortran/generated/spread_c4.c
index 5224e8477a9..e1a475f6f12 100644
--- a/libgfortran/generated/spread_c4.c
+++ b/libgfortran/generated/spread_c4.c
@@ -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
{
diff --git a/libgfortran/generated/spread_c8.c b/libgfortran/generated/spread_c8.c
index 96ecb3afb87..a2902908e76 100644
--- a/libgfortran/generated/spread_c8.c
+++ b/libgfortran/generated/spread_c8.c
@@ -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
{
diff --git a/libgfortran/generated/spread_i1.c b/libgfortran/generated/spread_i1.c
index e002c146262..111c4ccea5f 100644
--- a/libgfortran/generated/spread_i1.c
+++ b/libgfortran/generated/spread_i1.c
@@ -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
{
diff --git a/libgfortran/generated/spread_i16.c b/libgfortran/generated/spread_i16.c
index bdefdac3271..2a4864ba41c 100644
--- a/libgfortran/generated/spread_i16.c
+++ b/libgfortran/generated/spread_i16.c
@@ -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
{
diff --git a/libgfortran/generated/spread_i2.c b/libgfortran/generated/spread_i2.c
index 8482cfde857..5a5d87064e6 100644
--- a/libgfortran/generated/spread_i2.c
+++ b/libgfortran/generated/spread_i2.c
@@ -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
{
diff --git a/libgfortran/generated/spread_i4.c b/libgfortran/generated/spread_i4.c
index 6eff6326b26..e990408b0a4 100644
--- a/libgfortran/generated/spread_i4.c
+++ b/libgfortran/generated/spread_i4.c
@@ -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
{
diff --git a/libgfortran/generated/spread_i8.c b/libgfortran/generated/spread_i8.c
index 29312636306..1e3b3055b8f 100644
--- a/libgfortran/generated/spread_i8.c
+++ b/libgfortran/generated/spread_i8.c
@@ -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
{
diff --git a/libgfortran/generated/spread_r10.c b/libgfortran/generated/spread_r10.c
index 3c3f197b4c2..ef86bc59007 100644
--- a/libgfortran/generated/spread_r10.c
+++ b/libgfortran/generated/spread_r10.c
@@ -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
{
diff --git a/libgfortran/generated/spread_r16.c b/libgfortran/generated/spread_r16.c
index 13162609696..9678e8768a0 100644
--- a/libgfortran/generated/spread_r16.c
+++ b/libgfortran/generated/spread_r16.c
@@ -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
{
diff --git a/libgfortran/generated/spread_r4.c b/libgfortran/generated/spread_r4.c
index cc0f1197b69..fac0900cbb4 100644
--- a/libgfortran/generated/spread_r4.c
+++ b/libgfortran/generated/spread_r4.c
@@ -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
{
diff --git a/libgfortran/generated/spread_r8.c b/libgfortran/generated/spread_r8.c
index f38ef3885fc..0dd9e7bf5ad 100644
--- a/libgfortran/generated/spread_r8.c
+++ b/libgfortran/generated/spread_r8.c
@@ -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
{