1! { dg-do run } 2! { dg-require-effective-target tls_runtime } 3 4 use omp_lib 5 integer, allocatable, save :: a, b(:), c(:,:) 6 integer :: p 7!$omp threadprivate (a, b, c) 8 if (allocated (a) .or. allocated (b) .or. allocated (c)) stop 1 9 10 call omp_set_dynamic (.false.) 11 call omp_set_num_threads (4) 12 13!$omp parallel num_threads (4) 14 if (allocated (a) .or. allocated (b) .or. allocated (c)) stop 2 15!$omp end parallel 16 17 allocate (a, b(6:9), c(3, 8:9)) 18 a = 4 19 b = 5 20 c = 6 21 if (.not.allocated (a)) stop 3 22 if (.not.allocated (b) .or. size (b) /= 4) stop 4 23 if (lbound (b, 1) /= 6 .or. ubound (b, 1) /= 9) stop 5 24 if (.not.allocated (c) .or. size (c) /= 6) stop 6 25 if (size (c, 1) /= 3 .or. size (c, 2) /= 2) stop 7 26 if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) stop 8 27 if (lbound (c, 2) /= 8 .or. ubound (c, 2) /= 9) stop 9 28 29!$omp parallel num_threads (4) copyin (a, b, c) private (p) 30 p = omp_get_thread_num () 31 if (.not.allocated (a)) stop 10 32 if (.not.allocated (b) .or. size (b) /= 4) stop 11 33 if (lbound (b, 1) /= 6 .or. ubound (b, 1) /= 9) stop 12 34 if (.not.allocated (c) .or. size (c) /= 6) stop 13 35 if (size (c, 1) /= 3 .or. size (c, 2) /= 2) stop 14 36 if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) stop 15 37 if (lbound (c, 2) /= 8 .or. ubound (c, 2) /= 9) stop 16 38 if (a /= 4 .or. any (b /= 5) .or. any (c /= 6)) stop 17 39 deallocate (a, b, c) 40 if (allocated (a) .or. allocated (b) .or. allocated (c)) stop 18 41 allocate (a, b(p:9), c(3, p:7)) 42 a = p 43 b = p 44 c = p 45 if (.not.allocated (a)) stop 19 46 if (.not.allocated (b) .or. size (b) /= (10 - p)) stop 20 47 if (lbound (b, 1) /= p .or. ubound (b, 1) /= 9) stop 21 48 if (.not.allocated (c) .or. size (c) /= (3 * (8 - p))) stop 22 49 if (size (c, 1) /= 3 .or. size (c, 2) /= (8 - p)) stop 23 50 if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) stop 24 51 if (lbound (c, 2) /= p .or. ubound (c, 2) /= 7) stop 25 52 if (a /= p .or. any (b /= p) .or. any (c /= p)) stop 26 53!$omp end parallel 54 55!$omp parallel num_threads (4) copyin (a, b, c) 56 if (.not.allocated (a)) stop 27 57 if (.not.allocated (b) .or. size (b) /= 10) stop 28 58 if (lbound (b, 1) /= 0 .or. ubound (b, 1) /= 9) stop 29 59 if (.not.allocated (c) .or. size (c) /= 24) stop 30 60 if (size (c, 1) /= 3 .or. size (c, 2) /= 8) stop 31 61 if (lbound (c, 1) /= 1 .or. ubound (c, 1) /= 3) stop 32 62 if (lbound (c, 2) /= 0 .or. ubound (c, 2) /= 7) stop 33 63 if (a /= 0 .or. any (b /= 0) .or. any (c /= 0)) stop 34 64!$omp end parallel 65 66 deallocate (a, b, c) 67 if (allocated (a) .or. allocated (b) .or. allocated (c)) stop 35 68 69!$omp parallel num_threads (4) copyin (a, b, c) 70 if (allocated (a) .or. allocated (b) .or. allocated (c)) stop 36 71!$omp end parallel 72end 73