re PR fortran/21480 ([4.0 only] trivial reshape operation gives erroneous results)

2005-06-09  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/21480
	* m4/reshape.m4:  Use sizeof (rtype_name) for sizes to be passed
	to reshape_packed.
	* generated/reshape_c4.c:  Regenerated.
	* generated/reshape_c8.c:  Regenerated.
	* generated/reshape_i4.c:  Regenerated.
	* generated/reshape_i8.c:  Regenerated.

2005-06-09  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/21480
	* gfortran.dg/reshape-complex.f90:  Add a test for a packed
	complex array.

From-SVN: r100805
This commit is contained in:
Thomas Koenig 2005-06-09 19:43:27 +00:00 committed by Thomas Koenig
parent 8562f05c95
commit 92f5e87c2b
8 changed files with 36 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2005-06-09 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/21480
* gfortran.dg/reshape-complex.f90: Add a test for a packed
complex array.
2005-06-09 Nathan Sidwell <nathan@codesourcery.com>
* gcc.dg/alias-8.c: New.

View File

@ -1,11 +1,16 @@
! { dg-do run }
! PR 21127: Reshape of complex didn't work.
! PR 21480: Reshape of packed complex arrays didn't work either.
program main
complex, dimension(8) :: b
complex, dimension(2,2) :: a
complex, dimension(2) :: c,d
integer :: i
b = (/(i,i=1,8)/)
a = reshape(b(1:8:2),shape(a))
if (a(1,1) /= (1.0, 0.0) .or. a(2,1) /= (3.0, 0.0) .or. &
a(1,2) /= (5.0, 0.0) .or. a(2,2) /= (7.0, 0.0)) call abort
c = (/( 3.14, -3.14), (2.71, -2.71)/)
d = reshape(c, shape (d))
if (any (c .ne. d)) call abort
end

View File

@ -1,3 +1,13 @@
2005-06-09 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/21480
* m4/reshape.m4: Use sizeof (rtype_name) for sizes to be passed
to reshape_packed.
* generated/reshape_c4.c: Regenerated.
* generated/reshape_c8.c: Regenerated.
* generated/reshape_i4.c: Regenerated.
* generated/reshape_i8.c: Regenerated.
2005-06-07 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/21926

View File

@ -174,9 +174,9 @@ reshape_c4 (gfc_array_c4 * ret, gfc_array_c4 * source, shape_type * shape,
if (rsize != 0 && ssize != 0 && psize != 0)
{
rsize *= 4;
ssize *= 4;
psize *= 4;
rsize *= sizeof (GFC_COMPLEX_4);
ssize *= sizeof (GFC_COMPLEX_4);
psize *= sizeof (GFC_COMPLEX_4);
reshape_packed ((char *)ret->data, rsize, (char *)source->data,
ssize, pad ? (char *)pad->data : NULL, psize);
return;

View File

@ -174,9 +174,9 @@ reshape_c8 (gfc_array_c8 * ret, gfc_array_c8 * source, shape_type * shape,
if (rsize != 0 && ssize != 0 && psize != 0)
{
rsize *= 8;
ssize *= 8;
psize *= 8;
rsize *= sizeof (GFC_COMPLEX_8);
ssize *= sizeof (GFC_COMPLEX_8);
psize *= sizeof (GFC_COMPLEX_8);
reshape_packed ((char *)ret->data, rsize, (char *)source->data,
ssize, pad ? (char *)pad->data : NULL, psize);
return;

View File

@ -174,9 +174,9 @@ reshape_4 (gfc_array_i4 * ret, gfc_array_i4 * source, shape_type * shape,
if (rsize != 0 && ssize != 0 && psize != 0)
{
rsize *= 4;
ssize *= 4;
psize *= 4;
rsize *= sizeof (GFC_INTEGER_4);
ssize *= sizeof (GFC_INTEGER_4);
psize *= sizeof (GFC_INTEGER_4);
reshape_packed ((char *)ret->data, rsize, (char *)source->data,
ssize, pad ? (char *)pad->data : NULL, psize);
return;

View File

@ -174,9 +174,9 @@ reshape_8 (gfc_array_i8 * ret, gfc_array_i8 * source, shape_type * shape,
if (rsize != 0 && ssize != 0 && psize != 0)
{
rsize *= 8;
ssize *= 8;
psize *= 8;
rsize *= sizeof (GFC_INTEGER_8);
ssize *= sizeof (GFC_INTEGER_8);
psize *= sizeof (GFC_INTEGER_8);
reshape_packed ((char *)ret->data, rsize, (char *)source->data,
ssize, pad ? (char *)pad->data : NULL, psize);
return;

View File

@ -176,9 +176,9 @@ reshape_`'rtype_ccode (rtype * ret, rtype * source, shape_type * shape,
if (rsize != 0 && ssize != 0 && psize != 0)
{
rsize *= rtype_kind;
ssize *= rtype_kind;
psize *= rtype_kind;
rsize *= sizeof (rtype_name);
ssize *= sizeof (rtype_name);
psize *= sizeof (rtype_name);
reshape_packed ((char *)ret->data, rsize, (char *)source->data,
ssize, pad ? (char *)pad->data : NULL, psize);
return;