| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-funsigned" } |
| 3 |
program memain |
| 4 |
call test1 |
| 5 |
call test2 |
| 6 |
contains |
| 7 |
subroutine test1 |
| 8 |
unsigned, dimension(3) :: v |
| 9 |
unsigned, dimension(3,3) :: w, x |
| 10 |
integer, dimension(3) :: shft |
| 11 |
v = [1u, 2u, 3u] |
| 12 |
if (any(cshift(v,1) /= [2u,3u,1u])) error stop 1 |
| 13 |
w = reshape([1u,2u,3u,4u,5u,6u,7u,8u,9u],[3,3]) |
| 14 |
x = cshift(w, shift=[1,-2,1], dim=1) |
| 15 |
if (any(x /= reshape([2u,3u,1u,5u,6u,4u,8u,9u,7u],[3,3]))) error stop 2 |
| 16 |
shft = [2,-1,-2] |
| 17 |
x = cshift(w,shift=shft,dim=2) |
| 18 |
if (any(x /= reshape([7u,8u,6u,1u,2u,9u,4u,5u,3u],[3,3]))) error stop 3 |
| 19 |
end subroutine test1 |
| 20 |
subroutine test2 |
| 21 |
unsigned, dimension(3), parameter :: v = cshift([1u,2u,3u],1) |
| 22 |
unsigned, dimension(3,3), parameter :: w = reshape([1u,2u,3u,4u,5u,6u,7u,8u,9u],[3,3]) |
| 23 |
unsigned, dimension(3,3), parameter :: x = cshift(w,shift=[1,-2,1], dim=1) |
| 24 |
if (any(v /= [2u,3u,1u])) error stop 11 |
| 25 |
if (any(x /= reshape([2u,3u,1u,5u,6u,4u,8u,9u,7u],[3,3]))) error stop 12 |
| 26 |
end subroutine test2 |
| 27 |
end program memain |