diff options
author | Janus Weil <janus@gcc.gnu.org> | 2009-12-06 23:57:13 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2009-12-06 23:57:13 +0100 |
commit | a15b72fa7f318ab4e2bbdaddc0735b1f2185ddd0 (patch) | |
tree | d61a66c25b72f8351ac63e7b728dc56d39eba781 /libgfortran | |
parent | 3a5729ea2a8441fe2f9e583fb2ae28b56df2e24c (diff) | |
download | gcc-a15b72fa7f318ab4e2bbdaddc0735b1f2185ddd0.tar.gz |
re PR fortran/41478 (Corrupted memory using PACK for derived-types with allocated components)
libgfortran/
2009-12-06 Janus Weil <janus@gcc.gnu.org>
PR fortran/41478
PR fortran/42268
* intrinsics/pack_generic.c (pack): Add safety checks for the case that
'vector' is NULL.
gcc/testsuite/
2009-12-06 Janus Weil <janus@gcc.gnu.org>
PR fortran/41478
PR fortran/42268
* gfortran.dg/intrinsic_pack_5.f90: New test.
From-SVN: r155024
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 7 | ||||
-rw-r--r-- | libgfortran/intrinsics/pack_generic.c | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 7f69a16ce32..3c63896e2ee 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2009-12-06 Janus Weil <janus@gcc.gnu.org> + + PR fortran/41478 + PR fortran/42268 + * intrinsics/pack_generic.c (pack): Add safety checks for the case that + 'vector' is NULL. + 2009-12-05 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> * Makefile.in: Regenerate. diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c index 2e24105d485..ee6a4831db8 100644 --- a/libgfortran/intrinsics/pack_generic.c +++ b/libgfortran/intrinsics/pack_generic.c @@ -346,7 +346,7 @@ pack (gfc_array_char *ret, const gfc_array_char *array, case GFC_DTYPE_DERIVED_2: if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(array->data) - || GFC_UNALIGNED_2(vector->data)) + || (vector && GFC_UNALIGNED_2(vector->data))) break; else { @@ -357,7 +357,7 @@ pack (gfc_array_char *ret, const gfc_array_char *array, case GFC_DTYPE_DERIVED_4: if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(array->data) - || GFC_UNALIGNED_4(vector->data)) + || (vector && GFC_UNALIGNED_4(vector->data))) break; else { @@ -368,7 +368,7 @@ pack (gfc_array_char *ret, const gfc_array_char *array, case GFC_DTYPE_DERIVED_8: if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(array->data) - || GFC_UNALIGNED_8(vector->data)) + || (vector && GFC_UNALIGNED_8(vector->data))) break; else { @@ -379,7 +379,7 @@ pack (gfc_array_char *ret, const gfc_array_char *array, #ifdef HAVE_GFC_INTEGER_16 case GFC_DTYPE_DERIVED_16: if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(array->data) - || GFC_UNALIGNED_16(vector->data)) + || (vector && GFC_UNALIGNED_16(vector->data))) break; else { |