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