Fix compilation failure with C++98 compilers
[official-gcc.git] / gcc / testsuite / gfortran.dg / temporary_1.f90
blob20f88fa9c8760ff58650508754813e8a0e56dd8c
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)) STOP 1
16 end do
17 end do
19 contains
20 function test () result (res)
21 real(kind=kind(1.0d0)), dimension(2,2) :: res
22 res(1,1) = 1.d0
23 res(2,1) = 0.d0
24 res(1,2) = 0.d0
25 res(2,2) = 1.d0
26 end function
27 end