mdc-refcount-1-4-2.f90 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ! { dg-do run }
  2. ! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } }
  3. ! Copy of 'libgomp.oacc-fortran/mdc-refcount-1-4-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 detach(var%a)
  20. print *, "CheCKpOInT1"
  21. ! { dg-output ".*CheCKpOInT1(\n|\r\n|\r)" }
  22. !$acc exit data delete(var%a)
  23. !TODO { dg-output "(\n|\r\n|\r)libgomp: attach count underflow(\n|\r\n|\r)$" { target { ! openacc_host_selected } } } ! Scan for what we expect in the "XFAILed" case (without actually XFAILing).
  24. !TODO { dg-shouldfail "XFAILed" { ! openacc_host_selected } } ! ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all.
  25. !TODO { dg-final { if { [dg-process-target { xfail { ! openacc_host_selected } }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } } ! ... so that we still get an XFAIL visible in the log.
  26. print *, "CheCKpOInT2"
  27. ! { dg-output ".CheCKpOInT2(\n|\r\n|\r)" { target { openacc_host_selected } } }
  28. if (acc_is_present(var%a)) stop 3
  29. if (.not. acc_is_present(var)) stop 4
  30. !$acc end data
  31. if (acc_is_present(var%a)) stop 5
  32. if (acc_is_present(var)) stop 6
  33. deallocate(var%a)
  34. end program main