This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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 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
!-----------------------------------


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