* tree-loop-distribution.c (struct partition): New field recording
[official-gcc.git] / gcc / testsuite / gfortran.dg / simplify_cshift_1.f90
blobdbe67f4c8e9a032890b3a260fab07b77f77da423
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)) call abort
22 b = cshift(a, 2)
23 v = cshift(c, 2)
24 if (any(b /= v)) call abort
26 ! Special cases shift = 0, size(a), 1-size(a)
27 b = cshift([1, 2, 3, 4, 5], 0)
28 if (any(b /= a)) call abort
29 b = cshift([1, 2, 3, 4, 5], size(a))
30 if (any(b /= a)) call abort
31 b = cshift([1, 2, 3, 4, 5], 1-size(a))
32 if (any(b /= a)) call abort
34 ! simplification of array arg.
35 b = cshift(2 * a, 0)
36 if (any(b /= 2 * a)) call abort
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) call abort
44 end do
46 end program foo