public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/21127] New: reshape of complex broken
@ 2005-04-20 20:32 tkoenig at gcc dot gnu dot org
  2005-04-21  0:55 ` [Bug libfortran/21127] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-04-20 20:32 UTC (permalink / raw)
  To: gcc-bugs

$ cat reshape-complex.f90
program main
  complex, dimension(8) :: b
  complex, dimension(2,2) :: a
  integer :: i
  b = (/(i,i=1,8)/)
  a = reshape(b(1:8:2),shape(a))
  print *,a
end
$ gfortran -fdump-tree-original reshape-complex.f90
$ ./a.out
 (  1.000000    ,  2.000000    ) (  3.000000    ,  4.000000    ) (
1.4012985E-45,  2.476204    ) ( -1.999693    , 3.9988187E-34)

The problem is that we use

    atmp.5.dtype = 546;
    atmp.5.dim[0].stride = 1;
    atmp.5.dim[0].lbound = 0;
    atmp.5.dim[0].ubound = 1;
    atmp.5.dim[1].stride = 2;
    atmp.5.dim[1].lbound = 0;
    atmp.5.dim[1].ubound = 1;
    atmp.5.data = (complex4[0:] *) &A.6;
    atmp.5.offset = 0;

... 

    _gfortran_reshape_4 (&atmp.5, &parm.7, &atmp.11, 0B, 0B);

which is clearly wrong, because we treat the complex array like
a real array of the same shape.

We need a reshape_c4 and reshape_c8, which needs to be called
correctly from the front end.

-- 
           Summary: reshape of complex broken
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21127


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-05-19 22:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-20 20:32 [Bug libfortran/21127] New: reshape of complex broken tkoenig at gcc dot gnu dot org
2005-04-21  0:55 ` [Bug libfortran/21127] " pinskia at gcc dot gnu dot org
2005-04-22 13:09 ` tobi at gcc dot gnu dot org
2005-04-23 18:26 ` tkoenig at gcc dot gnu dot org
2005-05-03  8:23 ` tkoenig at gcc dot gnu dot org
2005-05-10 15:51 ` fxcoudert at gcc dot gnu dot org
2005-05-18 20:24 ` cvs-commit at gcc dot gnu dot org
2005-05-18 20:36 ` cvs-commit at gcc dot gnu dot org
2005-05-19 22:07 ` cvs-commit at gcc dot gnu dot org
2005-05-19 22:11 ` tkoenig at gcc dot gnu dot org
2005-05-19 22:30 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).