diff options
Diffstat (limited to 'libgfortran/generated/spread_r4.c')
-rw-r--r-- | libgfortran/generated/spread_r4.c | 12 |
1 files changed, 5 insertions, 7 deletions
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 { |