[Bug fortran/27662] New: Transpose doesn't work on function return

hjl at lucon dot org gcc-bugzilla@gcc.gnu.org
Thu May 18 17:50:00 GMT 2006


[hjl@gnu-19 tmp]$ cat x.f90
program foo
 implicit none
 real(kind=kind(1.0d0)), dimension (2, 2):: x, y, z;
 integer i, j
 open (10, status="scratch")
 write (10, *) "0.1000000000E+01    0.0000000000E+00"
 write (10, *) "0.0000000000E+00    0.1000000000E+01"
 rewind (10)
 read (10,*) x
 print "(2(e20.10))", x
 print *
 z = matmul (x, transpose (test ()))
 print "(2(e20.10))", z
 do i = 1, size (x, 1)
   do j = 1, size (x, 2)
     if (x (i, j) .ne. z (i, j)) call abort ()
   end do
 end do
 close (10)

contains
 function test () result (res)
   real(kind=kind(1.0d0)), dimension(2,2) :: res
   rewind (10)
   read (10,*) res
   print "(2(e20.10))", res
   print *
 end function
end
[hjl@gnu-19 tmp]$ /usr/gcc-4.2/bin/gfortran -static x.f90
[hjl@gnu-19 tmp]$ ./a.out
    0.1000000000E+01    0.0000000000E+00
    0.0000000000E+00    0.1000000000E+01

    0.1000000000E+01    0.0000000000E+00
    0.0000000000E+00    0.1000000000E+01

    0.1000000000E+01    0.0000000000E+00
    0.1000000000E+01    0.0000000000E+00
Aborted
[hjl@gnu-19 tmp]$


-- 
           Summary: Transpose doesn't work on function return
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl at lucon dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27662



More information about the Gcc-bugs mailing list