1! { dg-do run }
2! { dg-options "-fopenmp -fcray-pointer" }
3
4  use omp_lib
5  integer :: a, b, c, i, p
6  logical :: l
7  pointer (ip, p)
8  a = 1
9  b = 2
10  c = 3
11  l = .false.
12  ip = loc (a)
13
14!$omp parallel num_threads (2) reduction (.or.:l) firstprivate (ip)
15  l = p .ne. 1
16  ip = loc (b)
17  if (omp_get_thread_num () .eq. 1) ip = loc (c)
18  l = l .or. (p .ne. (2 + omp_get_thread_num ()))
19!$omp end parallel
20
21  if (l) call abort
22
23  l = .false.
24  ip = loc (a)
25!$omp parallel do num_threads (2) reduction (.or.:l) &
26!$omp & firstprivate (ip) lastprivate (ip)
27  do i = 0, 1
28    l = l .or. (p .ne. 1)
29    ip = loc (b)
30    if (i .eq. 1) ip = loc (c)
31    l = l .or. (p .ne. (2 + i))
32  end do
33
34  if (l) call abort
35  if (p .ne. 3) call abort
36end
37