allocatable4.f90 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ! { dg-do run }
  2. integer, allocatable :: a(:, :)
  3. integer :: b(6, 3)
  4. integer :: i, j
  5. logical :: k, l
  6. b(:, :) = 16
  7. l = .false.
  8. if (allocated (a)) call abort
  9. !$omp task private (a, b) shared (l)
  10. l = l.or.allocated (a)
  11. allocate (a(3, 6))
  12. l = l.or..not.allocated (a)
  13. l = l.or.size(a).ne.18.or.size(a,1).ne.3.or.size(a,2).ne.6
  14. a(3, 2) = 1
  15. b(3, 2) = 1
  16. deallocate (a)
  17. l = l.or.allocated (a)
  18. !$omp end task
  19. !$omp taskwait
  20. if (allocated (a).or.l) call abort
  21. allocate (a(6, 3))
  22. a(:, :) = 3
  23. if (.not.allocated (a)) call abort
  24. l = l.or.size(a).ne.18.or.size(a,1).ne.6.or.size(a,2).ne.3
  25. if (l) call abort
  26. !$omp task private (a, b) shared (l)
  27. l = l.or..not.allocated (a)
  28. a(3, 2) = 1
  29. b(3, 2) = 1
  30. !$omp end task
  31. !$omp taskwait
  32. if (l.or..not.allocated (a)) call abort
  33. !$omp task firstprivate (a, b) shared (l)
  34. l = l.or..not.allocated (a)
  35. l = l.or.size(a).ne.18.or.size(a,1).ne.6.or.size(a,2).ne.3
  36. do i = 1, 6
  37. l = l.or.(a(i, 1).ne.3).or.(a(i, 2).ne.3)
  38. l = l.or.(a(i, 3).ne.3).or.(b(i, 1).ne.16)
  39. l = l.or.(b(i, 2).ne.16).or.(b(i, 3).ne.16)
  40. end do
  41. a(:, :) = 7
  42. b(:, :) = 8
  43. !$omp end task
  44. !$omp taskwait
  45. if (any (a.ne.3).or.any (b.ne.16).or.l) call abort
  46. end