public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/21108] New: reshape with order causes memory corruption
@ 2005-04-19 20:09 tkoenig at gcc dot gnu dot org
  2005-04-22 13:22 ` [Bug libfortran/21108] " tobi at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-04-19 20:09 UTC (permalink / raw)
  To: gcc-bugs

... or so it seems.

This doesn't work:

$ cat reshape-2.f90
program resh
  real, dimension (0:1,0:2) :: a,c
  real, dimension (12) :: b
  b = (/(i,i=1,12)/)
  a = reshape(b(1:12:2),shape(a),order=(/2,1/))
  print '(6F8.3)',a
  c = reshape(b(1:12:2),shape(a),order=(/2,1/))
  print '(6F8.3)',c
end
$ gfortran reshape-2.f90
$ ./a.out
   0.000   0.000   0.000   2.029   2.027   2.025
  -2.000   2.022   0.000   2.166   0.000   0.000

This works:
$ cat reshape-2.f90
program resh
  real, dimension (0:1,0:2) :: a,c
  real, dimension (12) :: b
  b = (/(i,i=1,12)/)
  a = reshape(b(1:12:2),shape(a),order=(/2,1/))
  print '(6F8.3)',a
  c = reshape(b(1:12:2),shape(a),order=(/2,1/))
  print '(6F8.3)',c
end
$ gfortran reshape-2.f90
$ ./a.out
   0.000   0.000   0.000   2.029   2.027   2.025
  -2.000   2.022   0.000   2.166   0.000   0.000
$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.1/configure --enable-languages=c,f95 --prefix=/home/ig25
Thread model: posix
gcc version 4.1.0 20050419 (experimental)

Reshape is trickier than I thought, apparently.

-- 
           Summary: reshape with order causes memory corruption
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          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=21108


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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-19 20:09 [Bug libfortran/21108] New: reshape with order causes memory corruption tkoenig at gcc dot gnu dot org
2005-04-22 13:22 ` [Bug libfortran/21108] " tobi at gcc dot gnu dot org
2005-04-22 20:03 ` cvs-commit at gcc dot gnu dot org
2005-04-23 18:10 ` [Bug libfortran/21108] [4.0 only] reshape with order causes random results tkoenig at gcc dot gnu dot org
2005-04-29 11:02 ` fxcoudert at gcc dot gnu dot org
2005-05-21 19:57 ` cvs-commit at gcc dot gnu dot org
2005-05-21 20:30 ` tkoenig at gcc dot gnu dot org
2005-07-30 22:41 ` cvs-commit 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).