PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / transpose_conjg_1.f90
blob8865262517cf480188e5e84ac864a623217410d4
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)) STOP 1
25 d = matmul (b, a )
26 if (any (d /= matmul (transpose(conjg(a)), a))) STOP 2
27 if (any (d /= matmul (conjg(transpose(a)), a))) STOP 3
29 c = (0.0,1.0)
30 b = conjg(transpose(a + c))
31 d = transpose(conjg(a + c))
32 if (any (b /= d)) STOP 4
34 d = matmul (b, a + c)
35 if (any (d /= matmul (transpose(conjg(a + c)), a + c))) STOP 5
36 if (any (d /= matmul (conjg(transpose(a + c)), a + c))) STOP 6
37 END program main