diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-08-26 16:55:05 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-08-26 16:55:05 +0200 |
commit | a6c975bd8e847c29541026b66b33275b42df4995 (patch) | |
tree | 5460c14eafa145770f2aadf261d0b5fd64127454 /libgomp | |
parent | 2f27df53e757ee0ef77d042e92a7cd8e931e97f5 (diff) | |
download | gcc-a6c975bd8e847c29541026b66b33275b42df4995.zip gcc-a6c975bd8e847c29541026b66b33275b42df4995.tar.gz gcc-a6c975bd8e847c29541026b66b33275b42df4995.tar.bz2 |
trans-decl.c (get_proc_pointer_decl): Set DECL_TLS_MODEL if threadprivate.
* trans-decl.c (get_proc_pointer_decl): Set DECL_TLS_MODEL
if threadprivate.
* symbol.c (check_conflict): Allow threadprivate attribute with
FL_PROCEDURE if proc_pointer.
* testsuite/libgomp.fortran/threadprivate4.f90: New test.
From-SVN: r178114
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 4 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/threadprivate4.f90 | 78 |
2 files changed, 82 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index c5ebeb0..3786468 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,7 @@ +2011-08-26 Jakub Jelinek <jakub@redhat.com> + + * testsuite/libgomp.fortran/threadprivate4.f90: New test. + 2011-08-19 Jakub Jelinek <jakub@redhat.com> PR fortran/49792 diff --git a/libgomp/testsuite/libgomp.fortran/threadprivate4.f90 b/libgomp/testsuite/libgomp.fortran/threadprivate4.f90 new file mode 100644 index 0000000..b5fb10b --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/threadprivate4.f90 @@ -0,0 +1,78 @@ +! { dg-do run } +! { dg-require-effective-target tls_runtime } + +module threadprivate4 + integer :: vi + procedure(), pointer :: foo +!$omp threadprivate (foo, vi) + +contains + subroutine fn0 + vi = 0 + end subroutine fn0 + subroutine fn1 + vi = 1 + end subroutine fn1 + subroutine fn2 + vi = 2 + end subroutine fn2 + subroutine fn3 + vi = 3 + end subroutine fn3 +end module threadprivate4 + + use omp_lib + use threadprivate4 + + integer :: i + logical :: l + + procedure(), pointer :: bar1 + common /thrc/ bar1 +!$omp threadprivate (/thrc/) + + procedure(), pointer, save :: bar2 +!$omp threadprivate (bar2) + + l = .false. + call omp_set_dynamic (.false.) + call omp_set_num_threads (4) + +!$omp parallel num_threads (4) reduction (.or.:l) private (i) + i = omp_get_thread_num () + if (i.eq.0) then + foo => fn0 + bar1 => fn0 + bar2 => fn0 + elseif (i.eq.1) then + foo => fn1 + bar1 => fn1 + bar2 => fn1 + elseif (i.eq.2) then + foo => fn2 + bar1 => fn2 + bar2 => fn2 + else + foo => fn3 + bar1 => fn3 + bar2 => fn3 + end if + vi = -1 +!$omp barrier + vi = -1 + call foo () + l=l.or.(vi.ne.i) + vi = -2 + call bar1 () + l=l.or.(vi.ne.i) + vi = -3 + call bar2 () + l=l.or.(vi.ne.i) + vi = -1 +!$omp end parallel + + if (l) call abort + +end + +! { dg-final { cleanup-modules "threadprivate4" } } |