Reported by Clive Page, http://gcc.gnu.org/ml/fortran/2009-01/msg00335.html

Fails with gfortran 4.1, 4.2, 4.3 and 4.4, but works with NAG f95, g95, ifort
(9.1, 11.0), openf95.

The proper result of the test program is:
------------------------------------------
 normal
   1   2   3   4
  10  20  30  40
 100 200 300 400
 y-inverted
 100 200 300 400    <<<<<<<  These lines
  10  20  30  40    <<<<<<<  are missing
   1   2   3   4    <<<<<<<  with gfortran
------------------------------------------

The program:

!-----------------------------------------
module testy_mod
implicit none
contains
subroutine mysub(text, array)
character(len=*), intent(in) :: text
integer, intent(in) :: array(:,:)
integer :: j
print *, text
do j = 1, ubound(array,2)
   print '(10000i4)', array(:,j)
end do
end subroutine mysub
end module testy_mod

program testy
use testy_mod
implicit none
integer, parameter :: nx = 4, ny = 3
integer :: array(nx,ny)
data array / 1,2,3,4, 10,20,30,40, 100,200,300,400 /
call mysub('normal', array)
call mysub('y-inverted', array(:,ny:1:-1))
end program


-- 
           Summary: Wrong result for  array(:,ny:1:-1))  as actual argument
                    (inverting order by negative strides)
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 32834
             nThis:


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

Reply via email to