2 ! PR 56789 - packing / unpacking of contiguous arguments
9 real, contiguous
:: a(:,:)
16 end subroutine cont_arg
17 subroutine cont_pointer_arg (a
)
18 integer, pointer, contiguous
:: a(:)
20 call assumed_size(a(::1))
21 call assumed_size_2(a(::2))
22 end subroutine cont_pointer_arg
24 subroutine assumed_size(y
)
25 integer, dimension(*) :: y
26 if (y(2) /= 2 .or
. y(3) /= 3 .or
. y(4) /= 4 .or
. y(5) /= 5 .or
. y(6) /= 6) &
28 end subroutine assumed_size
30 subroutine assumed_size_2(y
)
31 integer, dimension(*) :: y
32 if (y(1) /= 1 .or
. y(2) /= 3 .or
. y(3) /= 5) stop 3
33 end subroutine assumed_size_2
35 subroutine cont_assumed_shape(x
)
36 integer, dimension(:), contiguous
:: x
37 if (size(x
,1) == 8) then
38 if (any(x
/= [1,2,3,4,5,6,7,8])) stop 4
40 if (any(x
/= [1,3,5,7])) stop 5
42 end subroutine cont_assumed_shape
48 real, dimension(5,5) :: a
49 real, dimension(5,5) :: res
50 integer, dimension(8), target
:: t
51 integer, dimension(:), pointer, contiguous
:: p
52 res
= reshape([11., 1.,12., 1.,13.,&
56 31., 1.,32., 1., 33.], shape(res
))
58 call cont_arg(a(1:5:2,1:5:2))
59 if (any(a
/= res
)) stop 1
62 call cont_pointer_arg(p
)
63 call cont_assumed_shape (t
)
64 call cont_assumed_shape (t(::2))