1! This test checks if the runtime can properly handle implicit
2! firstprivate varaibles inside subroutines in modules.
3
4! { dg-do run }
5
6module test_mod
7  contains
8    subroutine test(x)
9
10      IMPLICIT NONE
11
12      INTEGER      :: x, y, j
13
14      x = 5
15
16      !$ACC PARALLEL LOOP copyout (y)
17      DO j=1,10
18         y=x
19      ENDDO
20      !$ACC END PARALLEL LOOP
21
22      y = -1;
23
24      !$ACC PARALLEL LOOP firstprivate (y) copyout (x)
25      DO j=1,10
26         x=y
27      ENDDO
28      !$ACC END PARALLEL LOOP
29    end subroutine test
30end module test_mod
31
32program t
33  use test_mod
34
35  INTEGER      :: x_min
36
37  x_min = 8
38
39  CALL test(x_min)
40
41  if (x_min .ne. -1) STOP 1
42end program t
43