Skip gnat.dg/prot7.adb on hppa.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-fortran / non-scalar-data.f90
blob88fe5168b59163e1d7a4c75d5bace060200e278e
1 ! Ensure that a non-scalar dummy arguments which are implicitly used inside
2 ! offloaded regions are properly mapped using present_or_copy, or (default)
3 ! present.
5 ! { dg-do run }
7 program main
8 implicit none
10 integer,parameter :: size = 100
11 integer :: array(size), i, n
13 n = size
15 !$acc data copy(array)
17 call kernels(array, n)
19 !$acc update host(array)
21 do i = 1, n
22 if (array(i) .ne. i) STOP 1
23 end do
25 call kernels_default_present(array, n)
27 !$acc update host(array)
29 do i = 1, n
30 if (array(i) .ne. i+1) STOP 2
31 end do
33 call parallel(array, n)
35 !$acc update host(array)
37 do i = 1, n
38 if (array(i) .ne. i+i) STOP 3
39 end do
41 call parallel_default_present(array, n)
43 !$acc end data
45 do i = 1, n
46 if (array(i) .ne. i+i+1) STOP 4
47 end do
48 end program main
50 subroutine kernels (array, n)
51 integer, dimension (n) :: array
52 integer :: n, i
54 !$acc kernels
55 do i = 1, n
56 array(i) = i
57 end do
58 !$acc end kernels
59 end subroutine kernels
61 subroutine kernels_default_present (array, n)
62 integer, dimension (n) :: array
63 integer :: n, i
65 !$acc kernels default(present)
66 do i = 1, n
67 array(i) = i+1
68 end do
69 !$acc end kernels
70 end subroutine kernels_default_present
72 subroutine parallel (array, n)
73 integer, dimension (n) :: array
74 integer :: n, i
76 !$acc parallel
77 do i = 1, n
78 array(i) = i+i
79 end do
80 !$acc end parallel
81 end subroutine parallel
83 subroutine parallel_default_present (array, n)
84 integer, dimension (n) :: array
85 integer :: n, i
87 !$acc parallel default(present)
88 do i = 1, n
89 array(i) = i+i+1
90 end do
91 !$acc end parallel
92 end subroutine parallel_default_present