aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/goacc/default_none.f95
blob: 5ce66aeacf226653b64f6907dc81610b591043a9 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
! Ensure that the internal array variables, offset, lbound, etc., don't
! trigger errors with default(none).

! { dg-do compile }

program main
  implicit none
  integer i
  integer,parameter :: n = 100
  integer,allocatable :: a1(:), a2(:,:)

  allocate (a1 (n))
  allocate (a2 (-n:n,-n:n))
  a1 (:) = -1

  !$acc parallel loop default(none) copy (a1(1:n))
  do i = 1,n
     a1(i) = i
  end do
  !$acc end parallel loop

  call foo (a1)
  call bar (a1, n)
  call foobar (a2,n)

contains

  subroutine foo (da1)
    integer :: da1(n)

    !$acc parallel loop default(none) copy (da1(1:n))
    do i = 1,n
       da1(i) = i*2
    end do
    !$acc end parallel loop
  end subroutine foo
end program main

subroutine bar (da2,n)
  integer :: n, da2(n)
  integer i

  !$acc parallel loop default(none) copy (da2(1:n)) firstprivate(n)
  do i = 1,n
     da2(i) = i*3
  end do
  !$acc end parallel loop
end subroutine bar

subroutine foobar (da3,n)
  integer :: n, da3(-n:n,-n:n)
  integer i

  !$acc parallel loop default(none) copy (da3(-n:n,-n:n)) firstprivate(n)
  do i = 1,n
     da3(i,0) = i*3
  end do
  !$acc end parallel loop
end subroutine foobar