This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
bug report -- vector subscripts
- From: Zepu Zhang <zpzhang at uchicago dot edu>
- To: fortran at gcc dot gnu dot org
- Date: Tue, 28 Feb 2006 12:04:13 -0600
- Subject: bug report -- vector subscripts
On my Mac laptop I have GFortran finked several days ago. On my Linux
box I have GFortran "gcc version 4.0.3 20051201 (prerelease) (Debian
4.0.2-5)". I guess the finked version is slightly older.
The following program compiled on my Mac and worked as expected: <a> got
changed. On my Linux it compiled but didn't work as expected--<a> was
not changed.
Is this bug?
Is my usage standard-compliant or should it be discouraged? What's the
recommended workaround?
Thanks.
Zepu
!-------------------------------------
program test
interface
subroutine sub1(arr)
real, intent(inout) :: arr(:)
end subroutine sub1
end interface
real :: a(6)
call random_number(a)
print *, 'a:'
print *, a
call sub1(a)
print *, 'a modified:'
print *, a
end program test
subroutine sub1(arr)
real, intent(inout) :: arr(:)
integer :: idx(3)
idx = (/4, 5, 6/)
call sub2(arr(idx))
contains
subroutine sub2(brr)
real, intent(inout) :: brr(:)
brr = brr * 2.
end subroutine sub2
end subroutine sub1
!-----------------------------------