https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61780
Bug ID: 61780
Summary: [4.8/4.9/4.10 Regression] Wrong code when shifting
elements of a multidimensional array
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: dominiq at lps dot ens.fr
CC: pault at gcc dot gnu.org, tkoenig at gcc dot gnu.org
>From https://groups.google.com/forum/#!topic/comp.lang.fortran/mfS-BB2X-90, the
following code gives a wrong result at run time
program prgm3
implicit none
integer, parameter :: n = 10, k = 3
integer :: i, j
integer, dimension(n,n) :: y
integer :: res1(n), res2(n)
1 format(10i5)
!initialize
do i=1,n
do j=1,n
y(i,j) = n*i + j
end do
end do
res2 = y(k,:)
!shift right
y(k,4:n) = y(k,3:n-1)
y(k,3) = 0
res1 = y(k,:)
y(k,:) = res2
y(k,n:4:-1) = y(k,n-1:3:-1)
y(k,3) = 0
res2 = y(k,:)
print *, res1
print *, res2
if (any(res1 /= res2)) call abort ()
end program prgm3
Revision r174295 (2011-05-26) is OK, r174338 (2011-05-27) is not, likely
r174302 (pr48955).