This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/15553] Array copy operation produces garbage


------- Additional Comments From tobi at gcc dot gnu dot org  2004-09-21 13:45 -------
Are you sure, Andrew. My reduced testcase still fails for me on i686-pc-linux:
program arrpack
  implicit none

  integer x(1,1), y(1,1)
  integer i, j

  x = -1
  call pack (x, 1, 1)
  x = -1
  call copy (y, x, 1, 1)

contains

  subroutine pack (arr, ni, nj)
    integer, intent(in) :: ni, nj
    integer, intent(inout) :: arr(:,:)
    integer :: tmp(ni,nj)
    tmp(:,:) = arr(1:ni, 1:nj)
    print *, "pack"
    tmp(1,1) = -2
    call copy (arr, tmp, ni,nj) !tmp, ni, nj)
  end subroutine pack

  subroutine copy (dst, src, ni, nj)
    integer, intent(in) :: ni, nj
    integer :: dst(ni, nj)
    integer :: src(ni, nj)
    print *, "copy"
    print *, dst, src
    dst = src
    print *, dst, src
  end subroutine copy

end program arrpack

prints: 
[tobi@marktplatz tests]$ ./a.out
 pack
 copy
          -1          -2
          -2          -2
 copy
     9612368          -1
          -1          -1


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tobi at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]