PR ipa/83051
[official-gcc.git] / gcc / testsuite / gfortran.dg / function_optimize_9.f90
blobf220e475570130e2d8c95ead04b0906008ac815c
1 ! { dg-do compile }
2 ! { dg-options "-O -fdump-tree-original" }
3 program main
4 integer, parameter :: n=100
5 real, parameter :: pi=4*atan(1.)
6 real, parameter :: tmax=20.
7 real, parameter :: dt = tmax/(2*pi)/real(n)
8 real, parameter :: t0 = dt/30.
9 integer :: i
10 interface
11 pure function purefunc(x)
12 real :: purefunc
13 real, intent(in) :: x
14 end function purefunc
15 end interface
16 real :: a(n)
17 do i=1,n
18 a(i) = purefunc(dt*i + t0) * 3. + 2 * purefunc(t0 + i*dt)
19 end do
20 print *,a
21 end program main
22 ! { dg-final { scan-tree-dump-times "purefunc" 1 "original" } }