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

--- Comment #12 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-12-09 
13:42:57 UTC ---
The following is wrongly compiled - however, it is not a regression as it
occurs since GCC 4.1. The solution is the same as for
gfc_trans_arrayfunc_assign, where the same issue can occur. Cf. PR 44582.

Due to the missing temporary, the array contains 88 88 88 88 instead of 88 1 88
3; the test case works with ifort, NAG and g95.

(There is a slim chance that this is also the problem for Tonto as there was a
time window in 4.6 where this optimization was never applied; it should have
then also failed with 4.1 to 4.6.)


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
 end subroutine sub
end

Reply via email to