Merge from mainline.
[official-gcc.git] / gcc / testsuite / gfortran.dg / temporary_1.f90
blobe255efdb7a88bf90d754804d534054f16c20cfa8
1 ! { dg-do run }
2 ! PR 27662. Don't zero the first stride to indicate a temporary. It
3 ! may be used later.
4 program pr27662
5 implicit none
6 real(kind=kind(1.0d0)), dimension (2, 2):: x, y, z;
7 integer i, j
8 x(1,1) = 1.d0
9 x(2,1) = 0.d0
10 x(1,2) = 0.d0
11 x(2,2) = 1.d0
12 z = matmul (x, transpose (test ()))
13 do i = 1, size (x, 1)
14 do j = 1, size (x, 2)
15 if (x (i, j) .ne. z (i, j)) call abort ()
16 end do
17 end do
18 close (10)
20 contains
21 function test () result (res)
22 real(kind=kind(1.0d0)), dimension(2,2) :: res
23 res(1,1) = 1.d0
24 res(2,1) = 0.d0
25 res(1,2) = 0.d0
26 res(2,2) = 1.d0
27 end function
28 end