diff options
author | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-04 08:06:02 +0000 |
---|---|---|
committer | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-04 08:06:02 +0000 |
commit | 77d6d75eb7fe2bb68aee1f60c376ac6ed51680bc (patch) | |
tree | 8b1112ef5b4bc21bef6fd7da4fef8fc861f0618b /libgfortran/m4 | |
parent | f2271661a200bb8331073a4accfda4a37ffb5e6a (diff) | |
download | gcc-77d6d75eb7fe2bb68aee1f60c376ac6ed51680bc.tar.gz |
2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/35990
* intrinsics/pack_generic.c: If an extent of the source
array is less then zero, set it to zero. Set the source
pointer to NULL if the source size is zero. Set the total
number of elements to zero if the vector has an extent
less or equal to zero.
* m4/pack.m4: Set the source pointer to NULL if the
source array is zero-sized. Set the total number of
elemements to zero if the vector has an extent less or
equal to zero.
* generated/pack_i1.c: Regenerated.
* generated/pack_i2.c: Regenerated.
* generated/pack_i4.c: Regenerated.
* generated/pack_i8.c: Regenerated.
* generated/pack_i16.c: Regenerated.
* generated/pack_r4.c: Regenerated.
* generated/pack_r8.c: Regenerated.
* generated/pack_r10.c: Regenerated.
* generated/pack_r16.c: Regenerated.
* generated/pack_c4.c: Regenerated.
* generated/pack_c8.c: Regenerated.
* generated/pack_c10.c: Regenerated.
* generated/pack_c16.c: Regenerated.
2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/35990
* gfortran.dg/intrinsic_pack_4.f90: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134927 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/m4')
-rw-r--r-- | libgfortran/m4/pack.m4 | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libgfortran/m4/pack.m4 b/libgfortran/m4/pack.m4 index 87409a56223..4f31ffdd15e 100644 --- a/libgfortran/m4/pack.m4 +++ b/libgfortran/m4/pack.m4 @@ -104,7 +104,6 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array, dim = GFC_DESCRIPTOR_RANK (array); - sptr = array->data; mptr = mask->data; /* Use the same loop for all logical types, by using GFC_LOGICAL_1 @@ -140,6 +139,11 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array, if (mstride[0] == 0) mstride[0] = mask_kind; + if (zero_sized) + sptr = NULL; + else + sptr = array->data; + if (ret->data == NULL || compile_options.bounds_check) { /* Count the elements, either for allocating memory or @@ -150,6 +154,11 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array, /* The return array will have as many elements as there are in VECTOR. */ total = vector->dim[0].ubound + 1 - vector->dim[0].lbound; + if (total < 0) + { + total = 0; + vector = NULL; + } } else { @@ -309,4 +318,4 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array, } #endif -'
\ No newline at end of file +' |