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