OSDN Git Service

* gfortran.h (struct gfc_symbol): Add equiv_built.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.fortran-torture / execute / intrinsic_eoshift.f90
1 ! Program to test the eoshift intrinsic
2 program intrinsic_eoshift
3    integer, dimension(3, 3) :: a
4    integer, dimension(3, 3, 2) :: b
5
6    ! Scalar shift and scalar bound.
7    a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
8    a = eoshift (a, 1, 99, 1)
9    if (any (a .ne. reshape ((/2, 3, 99, 5, 6, 99, 8, 9, 99/), (/3, 3/)))) &
10       call abort
11
12    a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
13    a = eoshift (a, -2, dim = 2)
14    if (any (a .ne. reshape ((/0, 0, 0, 0, 0, 0, 1, 2, 3/), (/3, 3/)))) &
15       call abort
16
17    ! Array shift and scalar bound.
18    a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
19    a = eoshift (a, (/1, 0, -1/), 99, 1)
20    if (any (a .ne. reshape ((/2, 3, 99, 4, 5, 6, 99, 7, 8/), (/3, 3/)))) &
21       call abort
22
23    a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
24    a = eoshift (a, (/2, -2, 0/), dim = 2)
25    if (any (a .ne. reshape ((/7, 0, 3, 0, 0, 6, 0, 2, 9/), (/3, 3/)))) &
26       call abort
27
28    ! Scalar shift and array bound.
29    a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
30    a = eoshift (a, 1, (/99, -1, 42/), 1)
31    if (any (a .ne. reshape ((/2, 3, 99, 5, 6, -1, 8, 9, 42/), (/3, 3/)))) &
32       call abort
33
34    a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
35    a = eoshift (a, -2, (/99, -1, 42/), 2)
36    if (any (a .ne. reshape ((/99, -1, 42, 99, -1, 42, 1, 2, 3/), (/3, 3/)))) &
37       call abort
38
39    ! Array shift and array bound.
40    a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
41    a = eoshift (a, (/1, 0, -1/), (/99, -1, 42/), 1)
42    if (any (a .ne. reshape ((/2, 3, 99, 4, 5, 6, 42, 7, 8/), (/3, 3/)))) &
43       call abort
44
45    a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
46    a = eoshift (a, (/2, -2, 0/), (/99, -1, 42/), 2)
47    if (any (a .ne. reshape ((/7, -1, 3, 99, -1, 6, 99, 2, 9/), (/3, 3/)))) &
48       call abort
49
50    ! Test arrays > rank 2
51    b(:, :, 1) = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
52    b(:, :, 2) = 10 + reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
53    b = eoshift (b, 1, 99, 1)
54    if (any (b(:, :, 1) .ne. reshape ((/2, 3, 99, 5, 6, 99, 8, 9, 99/), (/3, 3/)))) &
55       call abort
56    if (any (b(:, :, 2) .ne. reshape ((/12, 13, 99, 15, 16, 99, 18, 19, 99/), (/3, 3/)))) &
57       call abort
58
59    ! TODO: Test array sections
60 end program