diff options
author | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-03 16:37:54 +0000 |
---|---|---|
committer | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-03 16:37:54 +0000 |
commit | 5f2a03f18f5ba405a9fda9e3259b3d1d910435cc (patch) | |
tree | 9602966aa875abbb82cf2f175ed23ea17e0a1d0d /libgfortran/intrinsics/pack_generic.c | |
parent | 4cd923bc66c236d80954d8e2651f6f83875e5f88 (diff) | |
download | gcc-5f2a03f18f5ba405a9fda9e3259b3d1d910435cc.tar.gz |
PR libfortran/31001
* intrinsics/pack_generic.c (pack_internal): Add special checks
for zero-sized arrays.
* gfortran.dg/zero_sized_3.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122507 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/intrinsics/pack_generic.c')
-rw-r--r-- | libgfortran/intrinsics/pack_generic.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c index 1b0d7250540..06e70844bf0 100644 --- a/libgfortran/intrinsics/pack_generic.c +++ b/libgfortran/intrinsics/pack_generic.c @@ -93,15 +93,19 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array, index_type count[GFC_MAX_DIMENSIONS]; index_type extent[GFC_MAX_DIMENSIONS]; + int zero_sized; index_type n; index_type dim; index_type nelem; dim = GFC_DESCRIPTOR_RANK (array); + zero_sized = 0; for (n = 0; n < dim; n++) { count[n] = 0; extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + if (extent[n] <= 0) + zero_sized = 1; sstride[n] = array->dim[n].stride * size; mstride[n] = mask->dim[n].stride; } @@ -154,6 +158,8 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array, const GFC_LOGICAL_4 *m = mptr; total = 0; + if (zero_sized) + m = NULL; while (m) { |