OSDN Git Service

gcc/fortran/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / transpose_conjg_1.f90
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.
8 !
9 !  Contributed by Dominik Muth <dominik.muth@gmx.de>
10 !
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.)
18 !
19   b = a
20   b = conjg(transpose(b))
21   d = a
22   d = transpose(conjg(d))
23   if (any (b /= d)) call abort ()
24 !
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 ()
28 !
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 ()
33 !
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