associate1.f90 483 B

123456789101112131415161718192021222324
  1. ! { dg-do run }
  2. program associate1
  3. integer :: v, i, j
  4. real :: a(3, 3)
  5. v = 15
  6. a = 4.5
  7. a(2,1) = 3.5
  8. i = 2
  9. j = 1
  10. associate(u => v, b => a(i, j))
  11. !$omp parallel private(v, a) default(none)
  12. v = -1
  13. a = 2.5
  14. if (v /= -1 .or. u /= 15) call abort
  15. if (a(2,1) /= 2.5 .or. b /= 3.5) call abort
  16. associate(u => v, b => a(2, 1))
  17. if (u /= -1 .or. b /= 2.5) call abort
  18. end associate
  19. if (u /= 15 .or. b /= 3.5) call abort
  20. !$omp end parallel
  21. end associate
  22. end program