Fix compilation failure with C++98 compilers
[official-gcc.git] / gcc / testsuite / gfortran.dg / simplify_cshift_1.f90
blob5e4be799151e14b3b8e6edd872cdcfa8c59c7952
1 ! { dg-do run }
2 program foo
4 implicit none
6 type t
7 integer i
8 end type t
10 type(t), parameter :: d(5) = [t(1), t(2), t(3), t(4), t(5)]
11 type(t) e(5), q(5)
13 integer, parameter :: a(5) = [1, 2, 3, 4, 5]
14 integer i, b(5), c(5), v(5)
16 c = [1, 2, 3, 4, 5]
18 b = cshift(a, -2)
19 v = cshift(c, -2)
20 if (any(b /= v)) STOP 1
22 b = cshift(a, 2)
23 v = cshift(c, 2)
24 if (any(b /= v)) STOP 2
26 ! Special cases shift = 0, size(a), -size(a)
27 b = cshift([1, 2, 3, 4, 5], 0)
28 if (any(b /= a)) STOP 3
29 b = cshift([1, 2, 3, 4, 5], size(a))
30 if (any(b /= a)) STOP 4
31 b = cshift([1, 2, 3, 4, 5], -size(a))
32 if (any(b /= a)) STOP 5
34 ! simplification of array arg.
35 b = cshift(2 * a, 0)
36 if (any(b /= 2 * a)) STOP 6
38 ! An array of derived types works too.
39 e = [t(1), t(2), t(3), t(4), t(5)]
40 e = cshift(e, 3)
41 q = cshift(d, 3)
42 do i = 1, 5
43 if (e(i)%i /= q(i)%i) STOP 7
44 end do
46 end program foo