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

* [Bug libfortran/21127] reshape of complex broken
  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 ` pinskia at gcc dot gnu dot org
  2005-04-22 13:09 ` tobi at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-21  0:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-21 00:55 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-04-21 00:55:15
               date|                            |


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


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

* [Bug libfortran/21127] reshape of complex broken
  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
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-04-22 13:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2005-04-22 13:09 -------
Or, alternatively, we could call reshape_generic.  Which of course would be evil
from a performance standpoitn :-)

-- 


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


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

* [Bug libfortran/21127] reshape of complex broken
  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
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-04-23 18:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-04-23 18:26 -------
(In reply to comment #2)
> Or, alternatively, we could call reshape_generic.  Which of course would be evil
> from a performance standpoitn :-)

Actually, that's what we are doing for a lot of intrinsics:

cshift1.m4:          memcpy (dest, src, size);
eoshift1.m4:          memcpy (dest, src, size);
eoshift1.m4:          memcpy (dest, pbound, size);
eoshift3.m4:          memcpy (dest, src, size);
eoshift3.m4:          memcpy (dest, bptr, size);
in_unpack.m4:      memcpy (dest, src, dsize * rtype_kind);

apparently to fix that same bug.

For better performance, these should be fixed as well.

-- 


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


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

* [Bug libfortran/21127] reshape of complex broken
  2005-04-20 20:32 [Bug libfortran/21127] New: reshape of complex broken tkoenig at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-05-03  8:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-05-03 08:23 -------
Patch here:

http://gcc.gnu.org/ml/fortran/2005-04/msg00716.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug libfortran/21127] reshape of complex broken
  2005-04-20 20:32 [Bug libfortran/21127] New: reshape of complex broken tkoenig at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2005-05-10 15:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From fxcoudert at gcc dot gnu dot org  2005-05-10 15:51 -------
*** Bug 21480 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kamaraju at gmail dot com


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


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

* [Bug libfortran/21127] reshape of complex broken
  2005-04-20 20:32 [Bug libfortran/21127] New: reshape of complex broken tkoenig at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-18 20:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-18 20:24 -------
Subject: Bug 21127

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tkoenig@gcc.gnu.org	2005-05-18 20:24:33

Modified files:
	libgfortran    : ChangeLog 
	gcc/fortran    : ChangeLog iresolve.c 
	gcc/testsuite  : ChangeLog 
	libgfortran/m4 : iparm.m4 reshape.m4 
Added files:
	libgfortran/generated: reshape_c4.c reshape_c8.c 
	gcc/testsuite/gfortran.dg: reshape-complex.f90 

Log message:
	2005-05-18  Thomas Koenig  <Thomas.Koenig@online.de>
	
	PR libfortran/21127
	* Makefile.am:  Add generated/reshape_c4.c and
	generated/reshape_c8.c.
	* Makefile.in:  Regenerated.
	* m4/iparm.m4:  Define rtype_ccode to be c4 or c8 for
	complex types, 4 or 8 otherwise.
	* m4/reshape.m4:  Use rtype_ccode instead of rtype_kind
	in function name.
	* generated/reshape_c4.c: New file.
	* generated/reshape_c8.c: New file.
	
	2005-05-18  Thomas Koenig  <Thomas.Koenig@online.de>
	
	PR libfortran/21127
	* fortran/iresolve.c (gfc_resolve_reshape): Add
	gfc_type_letter (BT_COMPLEX) for complex to
	to resolved function name.
	
	2005-05-18  Thomas Koenig  <Thomas.Koenig@online.de>
	
	PR libfortran/21127
	* gfortran.dg/reshape-complex.f90:  New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.223&r2=1.224
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_c4.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_c8.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.430&r2=1.431
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/iresolve.c.diff?cvsroot=gcc&r1=1.33&r2=1.34
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5492&r2=1.5493
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/reshape-complex.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/iparm.m4.diff?cvsroot=gcc&r1=1.4&r2=1.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/reshape.m4.diff?cvsroot=gcc&r1=1.8&r2=1.9



-- 


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


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

* [Bug libfortran/21127] reshape of complex broken
  2005-04-20 20:32 [Bug libfortran/21127] New: reshape of complex broken tkoenig at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-18 20:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-18 20:35 -------
Subject: Bug 21127

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tkoenig@gcc.gnu.org	2005-05-18 20:35:30

Modified files:
	libgfortran    : ChangeLog Makefile.am Makefile.in 

Log message:
	2005-05-18  Thomas Koenig  <Thomas.Koenig@online.de>
	
	PR libfortran/21127
	* Makefile.am:  Really commit.
	* Makefile.in:  Really commit.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.224&r2=1.225
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/Makefile.am.diff?cvsroot=gcc&r1=1.34&r2=1.35
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/Makefile.in.diff?cvsroot=gcc&r1=1.35&r2=1.36



-- 


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


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

* [Bug libfortran/21127] reshape of complex broken
  2005-04-20 20:32 [Bug libfortran/21127] New: reshape of complex broken tkoenig at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  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
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-19 22:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-19 22:07 -------
Subject: Bug 21127

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	tkoenig@gcc.gnu.org	2005-05-19 22:07:07

Modified files:
	libgfortran    : Makefile.am Makefile.in ChangeLog 
	gcc/fortran    : ChangeLog iresolve.c 
	gcc/testsuite  : ChangeLog 
	libgfortran/m4 : iparm.m4 reshape.m4 
Added files:
	libgfortran/generated: reshape_c4.c reshape_c8.c 
	gcc/testsuite/gfortran.dg: reshape-complex.f90 

Log message:
	2005-05-18  Thomas Koenig  <Thomas.Koenig@online.de>
	
	PR libfortran/21127
	* Makefile.am:  Add generated/reshape_c4.c and
	generated/reshape_c8.c.
	* Makefile.in:  Regenerated.
	* m4/iparm.m4:  Define rtype_ccode to be c4 or c8 for
	complex types, 4 or 8 otherwise.
	* m4/reshape.m4:  Use rtype_ccode instead of rtype_kind
	in function name.
	* generated/reshape_c4.c: New file.
	* generated/reshape_c8.c: New file.
	
	2005-05-18  Thomas Koenig  <Thomas.Koenig@online.de>
	
	PR libfortran/21127
	* fortran/iresolve.c (gfc_resolve_reshape): Add
	gfc_type_letter (BT_COMPLEX) for complex to
	to resolved function name.
	
	2005-05-18  Thomas Koenig  <Thomas.Koenig@online.de>
	
	PR libfortran/21127
	* gfortran.dg/reshape-complex.f90:  New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/Makefile.am.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.29.10.3&r2=1.29.10.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.30.10.3&r2=1.30.10.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.163.2.32&r2=1.163.2.33
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_c4.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_c8.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.335.2.52&r2=1.335.2.53
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/iresolve.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.32.2.1&r2=1.32.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.188&r2=1.5084.2.189
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/reshape-complex.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/iparm.m4.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4&r2=1.4.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/reshape.m4.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.6&r2=1.6.12.1



-- 


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


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

* [Bug libfortran/21127] reshape of complex broken
  2005-04-20 20:32 [Bug libfortran/21127] New: reshape of complex broken tkoenig at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  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
  9 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-05-19 22:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-05-19 22:10 -------
Fixed on mainline and 4.0.

There are still some reshape bugs in 4.0 which are not specific to
complex numbers, and whose fixes need to be backported.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug libfortran/21127] reshape of complex broken
  2005-04-20 20:32 [Bug libfortran/21127] New: reshape of complex broken tkoenig at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2005-05-19 22:11 ` tkoenig at gcc dot gnu dot org
@ 2005-05-19 22:30 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-19 22:30 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.1


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).