mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-10 19:25:46 +08:00
re PR fortran/35990 (run-time abort for PACK of run-time zero sized array)
2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/35990 * intrinsics/pack_generic.c: Really commit. From-SVN: r134928
This commit is contained in:
parent
7ad99d60f4
commit
9e6dca7594
@ -1,3 +1,8 @@
|
|||||||
|
2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR libfortran/35990
|
||||||
|
* intrinsics/pack_generic.c: Really commit.
|
||||||
|
|
||||||
2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org>
|
2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||||
|
|
||||||
PR libfortran/35990
|
PR libfortran/35990
|
||||||
|
@ -491,6 +491,7 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
|
|||||||
index_type dim;
|
index_type dim;
|
||||||
index_type ssize;
|
index_type ssize;
|
||||||
index_type nelem;
|
index_type nelem;
|
||||||
|
index_type total;
|
||||||
|
|
||||||
dim = GFC_DESCRIPTOR_RANK (array);
|
dim = GFC_DESCRIPTOR_RANK (array);
|
||||||
ssize = 1;
|
ssize = 1;
|
||||||
@ -498,6 +499,9 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
|
|||||||
{
|
{
|
||||||
count[n] = 0;
|
count[n] = 0;
|
||||||
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
|
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
|
||||||
|
if (extent[n] < 0)
|
||||||
|
extent[n] = 0;
|
||||||
|
|
||||||
sstride[n] = array->dim[n].stride * size;
|
sstride[n] = array->dim[n].stride * size;
|
||||||
ssize *= extent[n];
|
ssize *= extent[n];
|
||||||
}
|
}
|
||||||
@ -505,18 +509,26 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
|
|||||||
sstride[0] = size;
|
sstride[0] = size;
|
||||||
|
|
||||||
sstride0 = sstride[0];
|
sstride0 = sstride[0];
|
||||||
|
|
||||||
|
if (ssize != 0)
|
||||||
sptr = array->data;
|
sptr = array->data;
|
||||||
|
else
|
||||||
|
sptr = NULL;
|
||||||
|
|
||||||
if (ret->data == NULL)
|
if (ret->data == NULL)
|
||||||
{
|
{
|
||||||
/* Allocate the memory for the result. */
|
/* Allocate the memory for the result. */
|
||||||
int total;
|
|
||||||
|
|
||||||
if (vector != NULL)
|
if (vector != NULL)
|
||||||
{
|
{
|
||||||
/* The return array will have as many elements as there are
|
/* The return array will have as many elements as there are
|
||||||
in vector. */
|
in vector. */
|
||||||
total = vector->dim[0].ubound + 1 - vector->dim[0].lbound;
|
total = vector->dim[0].ubound + 1 - vector->dim[0].lbound;
|
||||||
|
if (total <= 0)
|
||||||
|
{
|
||||||
|
total = 0;
|
||||||
|
vector = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user