gcc/testsuite/gfortran.fortran-torture/execute/forall_6.f90
raw| 1 | ! Program to test FORALL with scalar pointer assignment inside it. |
| 2 | program forall_6 |
| 3 | type element |
| 4 | real, pointer :: p |
| 5 | end type |
| 6 | |
| 7 | type (element) q(5) |
| 8 | real, target, dimension(5) :: t |
| 9 | integer i; |
| 10 | |
| 11 | t = (/1.0, 2.0, 3.0, 4.0, 5.0/) |
| 12 | |
| 13 | do i = 1,5 |
| 14 | q(i)%p => t(i) |
| 15 | end do |
| 16 | |
| 17 | forall (i = 1:5) |
| 18 | q(i)%p => q(6 - i)%p |
| 19 | end forall |
| 20 | |
| 21 | |
| 22 | do i = 1,5 |
| 23 | if (q(i)%p .ne. t(6 - i)) STOP 1 |
| 24 | end do |
| 25 | end |