aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/dependency_44.f90
blob: ebfeec64c8d199ae24c75a1b2ba35cc235113a30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
! { dg-do run }
! Tests fix for PR61780 in which the loop reversal mechanism was
! not accounting for the first index being an element so that no
! loop in this dimension is created.
!
! Contributed by Manfred Tietze on clf.
!
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