[patch, libfortran] Fix for PR 21480 (yet another complex reshape failure)
Thomas Koenig
Thomas.Koenig@online.de
Wed Jun 8 19:48:00 GMT 2005
This fixes PR 21480.
Regression-tested on mainline. OK, also for 4.0 when it reopens?
Thomas
2005-06-08 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-08 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/21480
* gfortran.dg/reshape-complex.f90: Add a test for a packed
complex array.
-------------- next part --------------
Index: gcc/testsuite/gfortran.dg/reshape-complex.f90
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gfortran.dg/reshape-complex.f90,v
retrieving revision 1.1
diff -c -p -r1.1 reshape-complex.f90
*** gcc/testsuite/gfortran.dg/reshape-complex.f90 18 May 2005 20:24:32 -0000 1.1
--- gcc/testsuite/gfortran.dg/reshape-complex.f90 8 Jun 2005 19:23:28 -0000
***************
*** 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
-------------- next part --------------
Index: reshape.m4
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/m4/reshape.m4,v
retrieving revision 1.9
diff -c -p -r1.9 reshape.m4
*** reshape.m4 18 May 2005 20:24:32 -0000 1.9
--- reshape.m4 8 Jun 2005 19:37:01 -0000
*************** reshape_`'rtype_ccode (rtype * ret, rtyp
*** 176,184 ****
if (rsize != 0 && ssize != 0 && psize != 0)
{
! rsize *= rtype_kind;
! ssize *= rtype_kind;
! psize *= rtype_kind;
reshape_packed ((char *)ret->data, rsize, (char *)source->data,
ssize, pad ? (char *)pad->data : NULL, psize);
return;
--- 176,184 ----
if (rsize != 0 && ssize != 0 && psize != 0)
{
! 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;
More information about the Fortran
mailing list