mdc-refcount-1-2-2.f90 887 B

123456789101112131415161718192021222324252627282930313233343536
  1. ! { dg-do run }
  2. ! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } }
  3. ! Copy of 'libgomp.oacc-fortran/mdc-refcount-1-2-1.f90', without 'finalize' clause.
  4. program main
  5. use openacc
  6. implicit none
  7. integer, parameter :: n = 512
  8. type mytype
  9. integer, allocatable :: a(:)
  10. end type mytype
  11. type(mytype) :: var
  12. allocate(var%a(1:n))
  13. !$acc data create(var)
  14. call acc_create(var%a)
  15. ! After mapping via runtime API call, separately trigger attach action; see <https://github.com/OpenACC/openacc-spec/issues/301>.
  16. !$acc enter data attach(var%a)
  17. if (.not. acc_is_present(var%a)) stop 1
  18. if (.not. acc_is_present(var)) stop 2
  19. !$acc exit data delete(var%a)
  20. if (acc_is_present(var%a)) stop 3
  21. if (.not. acc_is_present(var)) stop 4
  22. !$acc end data
  23. if (acc_is_present(var%a)) stop 5
  24. if (acc_is_present(var)) stop 6
  25. deallocate(var%a)
  26. end program main