summaryrefslogtreecommitdiff
path: root/libgfortran/generated/spread_r8.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/generated/spread_r8.c')
-rw-r--r--libgfortran/generated/spread_r8.c12
1 files changed, 5 insertions, 7 deletions
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
{