summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.fortran-torture/execute/forall_6.f90
blob: af78ed36c615e3152881bfc89b9514fc26a57074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
! Program to test FORALL with scalar pointer assignment inside it.
program forall_6
  type element
    real, pointer :: p
  end type

  type (element) q(5)
  real, target, dimension(5) :: t
  integer i;

  t = (/1.0, 2.0, 3.0, 4.0, 5.0/)

  do i = 1,5
    q(i)%p => t(i)
  end do

  forall (i = 1:5)
    q(i)%p => q(6 - i)%p
  end forall


  do i = 1,5
    if (q(i)%p .ne. t(6 - i)) STOP 1
  end do
end