OSDN Git Service

PR debug/43983
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / transpose_1.f90
1 ! { dg-do compile }
2 ! Tests the fix for PR32962, in which the result of TRANSPOSE, when
3 ! an actual argument of an elemental intrinsic would receive the
4 ! wrong offset.
5 !
6 ! Contributed by Wirawan Purwanto <wirawan0@gmail.com>
7 !
8   real(kind=8), allocatable :: b(:,:)
9   real(kind=8) :: a(2,2), c(2,2)
10   i = 2
11   allocate (b(i,i))
12   a(1,1) = 2
13   a(2,1) = 3
14   a(1,2) = 7
15   a(2,2) = 11
16   call foo
17   call bar
18   if (any (c .ne. b)) call abort
19 contains
20   subroutine foo
21     b = cos(transpose(a))
22   end subroutine
23   subroutine bar
24     c = transpose(a)
25     c = cos(c)
26   end subroutine
27 end program