http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56937
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-04-12 20:56:36 UTC --- Is the following code valid? integer :: i, idx(4), r(4), p(4) p = [1,2,3,4] idx = [2,2,2,2] r = 0 r(idx) = p print *, sum(r) r = 0 do i = 1, 4 r(idx(i)) = p(i) end do print *, sum(r) r = 0 do i = 4, 1, -1 r(idx(i)) = p(i) end do print *, sum(r) end The output is 4 4 1 i.e., the value of r(2) depends on the way the assignment is scalarized: my rule of thumb for missing temporary and/or invalid code.