gcc/fortran/
[official-gcc.git] / gcc / testsuite / gfortran.dg / function_optimize_11.f90
blob2e4831b4ee07369ac4ffa60506f995e35063dc58
1 ! { dg-do run }
2 ! { dg-options "-ffrontend-optimize" }
3 ! Do not move common functions out of implicit DO loop constructors.
4 program test
5 integer, parameter :: N = 4
6 integer, parameter :: dp=kind(1.d0)
7 real(kind=dp), parameter :: pi=4*atan(1._dp)
8 real(kind=dp), parameter :: eps = 1.e-14_dp
9 real(kind=dp) :: h1(0:N-1), h2(0:N-1)
10 integer i
12 i = 1
13 h1 = [(cos(2*pi*mod(i*k,N)/N),k=0,N/2), &
14 & (sin(2*pi*mod(i*k,N)/N),k=1,N/2-1)]
15 h2 = (/ 1._dp, 0._dp, -1._dp, 1._dp /)
16 if (any(abs(h1 - h2) > eps)) call abort
17 end program test