2 ! Test functions returning arrays of indeterminate size.
4 integer, dimension(:, :), allocatable :: a
5 integer, dimension(2) :: b
8 a = reshape ((/1, 2, 3, 4, 5, 6/), (/2, 3/))
10 ! Using the return value as an actual argument
12 b = sum (transpose (a), 1);
13 if (any (b .ne. (/9, 12/))) call abort ()
15 ! Using the return value in an expression
17 b = sum (transpose (a) + 1, 1);
18 if (any (b .ne. (/12, 15/))) call abort ()
20 ! Same again testing a user function
21 ! TODO: enable these once this is implemented
23 ! b = sum (my_transpose (a), 1);
24 ! if (any (b .ne. (/9, 12/))) call abort ()
26 ! ! Using the return value in an expression
28 ! b = sum (my_transpose (a) + 1, 1);
29 ! if (any (b .ne. (/12, 15/))) call abort ()
32 integer, dimension (:, :) :: x
35 if (any (shape (x) .ne. (/3, 2/))) call abort
36 if (any (x .ne. (n + reshape((/1, 4, 2, 5, 3, 6/), (/3, 2/))))) call abort
39 function my_transpose (x) result (r)
41 pure function obfuscate (i)
43 integer, intent(in) :: i
46 integer, dimension (:, :) :: x
47 integer, dimension (obfuscate(ubound(x, 2)), &
48 obfuscate(ubound(x, 1))) :: r
51 do i = 1, ubound(x, 1)
57 pure function obfuscate (i)
59 integer, intent(in) :: i