* 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
+2007-03-03 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR libfortran/31001
+ * gfortran.dg/zero_sized_3.f90: New test.
+
2007-03-03 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/15787
--- /dev/null
+! { dg-do run }
+! Testcase for PR libfortran/31001
+ implicit none
+
+ integer :: i, j, k
+ integer, allocatable :: mm(:)
+ logical, allocatable :: mask(:)
+
+ do i = 2, -2, -1
+ do k = 0, 1
+ allocate (mm(i), mask(i))
+ mm(:) = k
+ mask(:) = (mm == 0)
+ j = count (mask)
+ print *, pack (mm, mask)
+ if (size (pack (mm, mask)) /= j) call abort
+ deallocate (mm, mask)
+ end do
+ end do
+end
+2007-03-03 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR libfortran/31001
+ * intrinsics/pack_generic.c (pack_internal): Add special checks
+ for zero-sized arrays.
+
2007-03-01 Brooks Moses <brooks.moses@codesourcery.com>
* Makefile.am: Add dummy install-pdf target.
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;
}
const GFC_LOGICAL_4 *m = mptr;
total = 0;
+ if (zero_sized)
+ m = NULL;
while (m)
{