Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / gfortran.fortran-torture / execute / retarray.f90
bloba0bdc97c47dad3a4348976300d1a8828208397d5
1 ! Program to test functions returning arrays
3 program testfnarray
4 implicit none
5 integer, dimension (6, 5) :: a
6 integer n
8 ! These first two shouldn't require a temporary.
9 a = 0
10 a = test(6, 5)
11 if (a(1,1) .ne. 42) call abort
12 if (a(6,5) .ne. 43) call abort
14 a = 0
15 a(1:6:2, 2:5) = test2()
16 if (a(1,2) .ne. 42) call abort
17 if (a(5,5) .ne. 43) call abort
19 a = 1
20 ! This requires a temporary
21 a = test(6, 5) - a
22 if (a(1,1) .ne. 41) call abort
23 if (a(6,5) .ne. 42) call abort
25 contains
27 function test (x, y)
28 implicit none
29 integer x, y
30 integer, dimension (1:x, 1:y) :: test
32 test(1, 1) = 42
33 test(x, y) = 43
34 end function
36 function test2 () result (foo)
37 implicit none
38 integer, dimension (3, 4) :: foo
40 foo(1, 1) = 42
41 foo(3, 4) = 43
42 end function
44 end program