aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/dependency_42.f90
blob: 8f067322f9a13e1660078a29a0ed3095bc4941e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
! { dg-do run }
! { dg-options "-Warray-temporaries" }
! PR fortran/56937 - unnecessary temporaries with vector indices
program main
  real :: q(4), r(4), p(3)
  integer :: idx(3)
  p = [0.5, 1.0, 2.0]
  idx = [4,3,1]
  r = 1.0
  r(idx) = r(idx) + p
  q = 1.0
  q(4) = q(4) + p(1)
  q(3) = q(3) + p(2)
  q(1) = q(1) + p(3)
  if (any (q - r /= 0)) call abort
end