Debian Codegraph @

libgomp/testsuite/libgomp.oacc-fortran/classtypes-1.f95

raw
1 ! { dg-do run }
2
3 module typemod
4
5 type :: typeimpl
6 real, pointer :: p(:) => null()
7 end type typeimpl
8
9 type :: basictype
10 class(typeimpl), pointer :: p => null()
11 end type basictype
12
13 type, extends(basictype) :: regulartype
14 character :: void
15 end type regulartype
16
17 end module typemod
18
19 program main
20 use typemod
21 implicit none
22 type(regulartype), pointer :: myvar
23 integer :: i
24 real :: j, k
25
26 allocate(myvar)
27 allocate(myvar%p)
28 allocate(myvar%p%p(1:100))
29
30 do i=1,100
31 myvar%p%p(i) = -1.0
32 end do
33
34 !$acc enter data copyin(myvar)
35 !$acc enter data copyin(myvar%p) create(myvar%p%p)
36
37 !$acc parallel loop present(myvar%p%p)
38 do i=1,100
39 myvar%p%p(i) = i * 2
40 end do
41 !$acc end parallel loop
42
43 !$acc exit data copyout(myvar%p%p) delete(myvar%p)
44 !$acc exit data delete(myvar)
45
46 do i=1,100
47 if (myvar%p%p(i) .ne. i * 2) stop 1
48 end do
49
50 end program main