diff options
Diffstat (limited to 'libgfortran/intrinsics/pack_generic.c')
-rw-r--r-- | libgfortran/intrinsics/pack_generic.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c index c15bdd0..de1e07f 100644 --- a/libgfortran/intrinsics/pack_generic.c +++ b/libgfortran/intrinsics/pack_generic.c @@ -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); |