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

           Summary: Wrong code with transpose(a) passed to subroutine
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: jvdeli...@gcc.gnu.org


This test case is from comment 12 of pr46842 and is a new bug.

integer :: a(2,2)
a = reshape([1,2,3,4], [2,2])
call sub(transpose(a))
contains
 subroutine sub(x)
   integer :: x(:,:)
   a(1,:) = 88
   a(2,:) = x(:,1)
   if (any (a(:,1) /= [88, 1]).or.any (a(:,2) /= [88, 3])) then
     print *, a
     call abort()
   end if
   print *, a
 end subroutine sub
end

Gives:

$ ./a.out 
          88          88          88          88

Should give:

$ ./a.out 
          88           1          88           3

This is a serious bug and should get some priority.

Reply via email to