gcc/testsuite/gfortran.fortran-torture/execute/where18.f90
raw| 1 | ! Check to ensure mask is calculated first in WHERE |
| 2 | ! statements. |
| 3 | program where_18 |
| 4 | integer :: a(4) |
| 5 | integer :: b(3) |
| 6 | integer :: c(3) |
| 7 | equivalence (a(1), b(1)), (a(2), c(1)) |
| 8 | |
| 9 | a = (/1, 1, 1, 1/) |
| 10 | where (b .eq. 1) |
| 11 | c = 2 |
| 12 | elsewhere (b .eq. 2) |
| 13 | c = 3 |
| 14 | endwhere |
| 15 | if (any (a .ne. (/1, 2, 2, 2/))) & |
| 16 | STOP 1 |
| 17 | |
| 18 | a = (/1, 1, 1, 1/) |
| 19 | where (c .eq. 1) |
| 20 | b = 2 |
| 21 | elsewhere (b .eq. 2) |
| 22 | b = 3 |
| 23 | endwhere |
| 24 | if (any (a .ne. (/2, 2, 2, 1/))) & |
| 25 | STOP 2 |
| 26 | end program |