2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / transpose_conjg_1.f90
blob3b28827b38ab2f5aca9ae73cac1e4a37b7fcdedc
1 ! { dg-do run }
2 ! Tests the fix for PR35740, where the trick of interchanging the descriptor
3 ! dimensions to implement TRANSPOSE did not work if it is an argument of
4 ! an elemental function - eg. CONJG. The fix forces a library call for such
5 ! cases. During the diagnosis of the PR, it was found that the scalarizer was
6 ! completely thrown if the argument of TRANSPOSE was a non-variable
7 ! expression; eg a + c below. This is also fixed by the library call.
9 ! Contributed by Dominik Muth <dominik.muth@gmx.de>
11 program main
12 implicit none
13 complex, dimension(2,2) :: a,b,c,d
14 a(1,1) = (1.,1.)
15 a(2,1) = (2.,2.)
16 a(1,2) = (3.,3.)
17 a(2,2) = (4.,4.)
19 b = a
20 b = conjg(transpose(b))
21 d = a
22 d = transpose(conjg(d))
23 if (any (b /= d)) call abort ()
25 d = matmul (b, a )
26 if (any (d /= matmul (transpose(conjg(a)), a))) call abort ()
27 if (any (d /= matmul (conjg(transpose(a)), a))) call abort ()
29 c = (0.0,1.0)
30 b = conjg(transpose(a + c))
31 d = transpose(conjg(a + c))
32 if (any (b /= d)) call abort ()
34 d = matmul (b, a + c)
35 if (any (d /= matmul (transpose(conjg(a + c)), a + c))) call abort ()
36 if (any (d /= matmul (conjg(transpose(a + c)), a + c))) call abort ()
37 END program main