| 1 |
! { dg-do run } |
| 2 |
! Tests fix for PR61780 in which the loop reversal mechanism was |
| 3 |
! not accounting for the first index being an element so that no |
| 4 |
! loop in this dimension is created. |
| 5 |
! |
| 6 |
! Contributed by Manfred Tietze on clf. |
| 7 |
! |
| 8 |
program prgm3 |
| 9 |
implicit none |
| 10 |
integer, parameter :: n = 10, k = 3 |
| 11 |
integer :: i, j |
| 12 |
integer, dimension(n,n) :: y |
| 13 |
integer :: res1(n), res2(n) |
| 14 |
|
| 15 |
1 format(10i5) |
| 16 |
|
| 17 |
!initialize |
| 18 |
do i=1,n |
| 19 |
do j=1,n |
| 20 |
y(i,j) = n*i + j |
| 21 |
end do |
| 22 |
end do |
| 23 |
res2 = y(k,:) |
| 24 |
|
| 25 |
!shift right |
| 26 |
y(k,4:n) = y(k,3:n-1) |
| 27 |
y(k,3) = 0 |
| 28 |
res1 = y(k,:) |
| 29 |
y(k,:) = res2 |
| 30 |
y(k,n:4:-1) = y(k,n-1:3:-1) |
| 31 |
y(k,3) = 0 |
| 32 |
res2 = y(k,:) |
| 33 |
! print *, res1 |
| 34 |
! print *, res2 |
| 35 |
if (any(res1 /= res2)) STOP 1 |
| 36 |
end program prgm3 |