conjg(transpose(a)) still gives wrong results, if it is assigned to a.
transpose(conjg(a)) works.
program main
implicit none
complex, dimension(2,2) :: a,b,c
a(1,1) = (1.,1.)
a(2,1) = (2.,2.)
a(1,2) = (3.,3.)
a(2,2) = (4.,4.)
print *, "original: ",a
b = conjg(transpose(a))
print *, "H(a) - once wrong, now right: ",b
c = transpose(a)
c = conjg(c)
print *, "H(a) - right: ",c
a = conjg(transpose(a))
print *, "H(a) - still wrong: ",a
a = transpose(c)
a = conjg(a)
a = transpose(conjg(a))
print *, "H(a) - hack around: ",a
END program main
gfortran -v:
Target: x86_64-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr
--disable-libmudflap --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.2.3 (Debian 4.2.3-1)
--
Summary: a = conjg(transpose(a)) still gives wrong results, see
bug 31994
Product: gcc
Version: 4.2.3
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dominik dot muth at gmx dot de
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35740