diff options
Diffstat (limited to 'libgfortran/m4/pack.m4')
-rw-r--r-- | libgfortran/m4/pack.m4 | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/libgfortran/m4/pack.m4 b/libgfortran/m4/pack.m4 index c5fd2fd817d..e1882d077c2 100644 --- a/libgfortran/m4/pack.m4 +++ b/libgfortran/m4/pack.m4 @@ -167,14 +167,12 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *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 ('rtype_name`) * 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 ('rtype_name`) * total); + return; } else { |