PR middle-end/77674
[official-gcc.git] / gcc / testsuite / gfortran.dg / pr65450.f90
blob700fc64789cfd50eb48f6445525e2a2bcfdb9243
1 ! PR tree-optimization/65450
2 ! { dg-do run }
3 ! { dg-additional-options "-mtune=amdfam10" { target x86_64-*-* i?86-*-* } }
5 program pr65450
6 integer :: n, m, o, i, k
7 double precision :: u(500,60,3), h(500,60,3)
8 double precision :: v(500,60)
9 u = 0
10 h = 0
11 o = 1
12 m = 2
13 n = 3
14 do k = 1, 50
15 v = foo (u(:,:,m))
16 u(2:499,1:60,n) = u(2:499,1:60,o)+16.d0
17 h(1:500,2:59,n) = h(1:500,2:59,o)-4.d0*v(1:500,2:59)-32.0d0
18 i = o
19 o = m
20 m = n
21 n = i
22 end do
23 if (abs (v(17, 23) + h(17, 23, 2) + 768.0d0) > 0.5d0) call abort
24 contains
25 function foo(a)
26 double precision :: a(:,:)
27 double precision :: foo(size(a,dim=1),size(a,dim=2))
28 integer :: i, j
29 i = size(a,dim=1)
30 j = size(a,dim=2)
31 foo(2:i-1,1:j) = a(3:i,1:j)-a(1:i-2,1:j)
32 foo(1,1:j) = 2*(a(2,1:j)-a(1,1:j))
33 foo(i,1:j) = 2*(a(i,1:j)-a(i-1,1:j))
34 end function foo
35 end program pr65450