public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/21480] New: trivial reshape operation gives erroneous results
@ 2005-05-09 23:04 kamaraju at gmail dot com
  2005-05-10 15:51 ` [Bug fortran/21480] " fxcoudert at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: kamaraju at gmail dot com @ 2005-05-09 23:04 UTC (permalink / raw)
  To: gcc-bugs

$cat reshape_bug.f90
program reshape_bug
 implicit none
 integer, parameter :: NX = 2
 complex :: a(0:NX-1)

 a(:) = cmplx(0.0, 0.0)
 write(*,*) 'before'
 write(*,*) a(:)
 a(0:NX-1) = reshape(a(0:NX-1), (/NX/))
 write(*,*) 'after'
 write(*,*) a(:)
end program reshape_bug

$gfortran-snapshot reshape_bug.f90

$./a.out
 before
 (  0.000000    ,  0.000000    ) (  0.000000    ,  0.000000    )
 after
 (  0.000000    ,  0.000000    ) (  2.022202    ,  0.000000    )

The program changes the value of a(2) once reshape function is executed. But
infact a(2) should just remain as (  0.000000    ,  0.000000    ).

Using debian, sid.
$gfortran-snapshot -v
Using built-in specs.
Target: i486-linux
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang
--prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --disable-nls
--program-suffix=-20050507-1 --enable-__cxa_atexit
--enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug
--enable-java-gc=boehm --enable-java-awt=gtk --enable-mpfr --disable-werror
--disable-werror i486-linux
Thread model: posix
gcc version 4.1.0 20050507 (experimental)

-- 
           Summary: trivial reshape operation gives erroneous results
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kamaraju at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug fortran/21480] trivial reshape operation gives erroneous results
  2005-05-09 23:04 [Bug fortran/21480] New: trivial reshape operation gives erroneous results kamaraju at gmail dot com
@ 2005-05-10 15:51 ` fxcoudert at gcc dot gnu dot org
  2005-06-08 17:32 ` tobi at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ 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 -------
Yes, there is a bug with reshape and complex numbers (PR21127). It should be
fixed soon (a patch has been proposed).

*** This bug has been marked as a duplicate of 21127 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

* [Bug fortran/21480] trivial reshape operation gives erroneous results
  2005-05-09 23:04 [Bug fortran/21480] New: trivial reshape operation gives erroneous results kamaraju at gmail dot com
  2005-05-10 15:51 ` [Bug fortran/21480] " fxcoudert at gcc dot gnu dot org
@ 2005-06-08 17:32 ` tobi at gcc dot gnu dot org
  2005-06-08 18:06 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-06-08 17:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2005-06-08 17:32 -------
Reopened, the bug is still present, and apparently completely unrelated to PR21127.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
           Keywords|                            |wrong-code
         Resolution|DUPLICATE                   |


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


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

* [Bug fortran/21480] trivial reshape operation gives erroneous results
  2005-05-09 23:04 [Bug fortran/21480] New: trivial reshape operation gives erroneous results kamaraju at gmail dot com
  2005-05-10 15:51 ` [Bug fortran/21480] " fxcoudert at gcc dot gnu dot org
  2005-06-08 17:32 ` tobi at gcc dot gnu dot org
@ 2005-06-08 18:06 ` pinskia at gcc dot gnu dot org
  2005-06-08 18:59 ` tkoenig at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-08 18:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-08 18:06 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-08 18:06:36
               date|                            |


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


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

* [Bug fortran/21480] trivial reshape operation gives erroneous results
  2005-05-09 23:04 [Bug fortran/21480] New: trivial reshape operation gives erroneous results kamaraju at gmail dot com
                   ` (2 preceding siblings ...)
  2005-06-08 18:06 ` pinskia at gcc dot gnu dot org
@ 2005-06-08 18:59 ` tkoenig at gcc dot gnu dot org
  2005-06-08 20:20 ` tkoenig at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-06-08 18:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-06-08 18:59 -------
Slightly reduced testcase:

$ cat 21480.f90
program reshape_bug
 implicit none
 complex :: a(2), b(2)

 a = (/(1.0, -1.0), (2.0, -2.0)/)
 write(*,*) 'from'
 write(*,*) a
 b=reshape(a, shape(a))
 write(*,*) 'to'
 write(*,*) b
end program reshape_bug

$ gfortran 21480.f90
$ ./a.out
 from
 (  1.000000    , -1.000000    ) (  2.000000    , -2.000000    )
 to
 (  1.000000    , -1.000000    ) ( 2.8025969E-45,  2.200292    )

In other words, this has nothing to do with arrays starting
at 0.

-- 


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


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

* [Bug fortran/21480] trivial reshape operation gives erroneous results
  2005-05-09 23:04 [Bug fortran/21480] New: trivial reshape operation gives erroneous results kamaraju at gmail dot com
                   ` (3 preceding siblings ...)
  2005-06-08 18:59 ` tkoenig at gcc dot gnu dot org
@ 2005-06-08 20:20 ` tkoenig at gcc dot gnu dot org
  2005-06-09 19:43 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-06-08 20:20 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |tkoenig at gcc dot gnu dot
                   |dot org                     |org
                URL|                            |http://gcc.gnu.org/ml/fortra
                   |                            |n/2005-06/msg00172.html
             Status|NEW                         |ASSIGNED
           Keywords|                            |patch
   Last reconfirmed|2005-06-08 18:06:36         |2005-06-08 20:20:21
               date|                            |


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


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

* [Bug fortran/21480] trivial reshape operation gives erroneous results
  2005-05-09 23:04 [Bug fortran/21480] New: trivial reshape operation gives erroneous results kamaraju at gmail dot com
                   ` (4 preceding siblings ...)
  2005-06-08 20:20 ` tkoenig at gcc dot gnu dot org
@ 2005-06-09 19:43 ` cvs-commit at gcc dot gnu dot org
  2005-06-09 19:46 ` tkoenig at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-09 19:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-09 19:43 -------
Subject: Bug 21480

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tkoenig@gcc.gnu.org	2005-06-09 19:43:27

Modified files:
	libgfortran    : ChangeLog 
	libgfortran/m4 : reshape.m4 
	libgfortran/generated: reshape_c4.c reshape_c8.c reshape_i4.c 
	                       reshape_i8.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/gfortran.dg: reshape-complex.f90 

Log message:
	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.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.234&r2=1.235
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/reshape.m4.diff?cvsroot=gcc&r1=1.9&r2=1.10
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_c4.c.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_c8.c.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_i4.c.diff?cvsroot=gcc&r1=1.7&r2=1.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_i8.c.diff?cvsroot=gcc&r1=1.7&r2=1.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5618&r2=1.5619
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/reshape-complex.f90.diff?cvsroot=gcc&r1=1.1&r2=1.2



-- 


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


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

* [Bug fortran/21480] trivial reshape operation gives erroneous results
  2005-05-09 23:04 [Bug fortran/21480] New: trivial reshape operation gives erroneous results kamaraju at gmail dot com
                   ` (5 preceding siblings ...)
  2005-06-09 19:43 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-09 19:46 ` tkoenig at gcc dot gnu dot org
  2005-07-17 19:12 ` [Bug fortran/21480] [4.0 only] " cvs-commit at gcc dot gnu dot org
  2005-07-17 19:13 ` tkoenig at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-06-09 19:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-06-09 19:46 -------
Fixed in 4.1, waiting for 4.0 to reopen.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.0.1
      Known to work|                            |4.1.0
   Target Milestone|---                         |4.0.2


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


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

* [Bug fortran/21480] [4.0 only] trivial reshape operation gives erroneous results
  2005-05-09 23:04 [Bug fortran/21480] New: trivial reshape operation gives erroneous results kamaraju at gmail dot com
                   ` (6 preceding siblings ...)
  2005-06-09 19:46 ` tkoenig at gcc dot gnu dot org
@ 2005-07-17 19:12 ` cvs-commit at gcc dot gnu dot org
  2005-07-17 19:13 ` tkoenig at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-17 19:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-17 19:12 -------
Subject: Bug 21480

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

Modified files:
	libgfortran    : ChangeLog 
	libgfortran/generated: reshape_c4.c reshape_c8.c reshape_i4.c 
	                       reshape_i8.c 
	libgfortran/m4 : reshape.m4 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/gfortran.dg: reshape-complex.f90 

Log message:
	2005-07-17  Thomas Koenig  <Thomas.Koenig@online.de>
	
	Backport from mainline.
	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-07-17  Thomas Koenig  <Thomas.Koenig@online.de>
	
	Backport from mainline.
	PR libfortran/21480
	* gfortran.dg/reshape-complex.f90:  Add a test for a packed
	complex array.

Patches:
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.64&r2=1.163.2.65
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=1.1.2.3&r2=1.1.2.4
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=1.1.2.3&r2=1.1.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_i4.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5.12.2&r2=1.5.12.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_i8.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5.12.2&r2=1.5.12.3
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.12.3&r2=1.6.12.4
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.283&r2=1.5084.2.284
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=1.1.2.1&r2=1.1.2.2



-- 


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


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

* [Bug fortran/21480] [4.0 only] trivial reshape operation gives erroneous results
  2005-05-09 23:04 [Bug fortran/21480] New: trivial reshape operation gives erroneous results kamaraju at gmail dot com
                   ` (7 preceding siblings ...)
  2005-07-17 19:12 ` [Bug fortran/21480] [4.0 only] " cvs-commit at gcc dot gnu dot org
@ 2005-07-17 19:13 ` tkoenig at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-07-17 19:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-07-17 19:12 -------
Fixed in 4.0.

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


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


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

end of thread, other threads:[~2005-07-17 19:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-09 23:04 [Bug fortran/21480] New: trivial reshape operation gives erroneous results kamaraju at gmail dot com
2005-05-10 15:51 ` [Bug fortran/21480] " fxcoudert at gcc dot gnu dot org
2005-06-08 17:32 ` tobi at gcc dot gnu dot org
2005-06-08 18:06 ` pinskia at gcc dot gnu dot org
2005-06-08 18:59 ` tkoenig at gcc dot gnu dot org
2005-06-08 20:20 ` tkoenig at gcc dot gnu dot org
2005-06-09 19:43 ` cvs-commit at gcc dot gnu dot org
2005-06-09 19:46 ` tkoenig at gcc dot gnu dot org
2005-07-17 19:12 ` [Bug fortran/21480] [4.0 only] " cvs-commit at gcc dot gnu dot org
2005-07-17 19:13 ` tkoenig 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).