diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-23 10:31:00 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-23 10:31:00 +0000 |
commit | b86e0fd4e3e18063c865f2921f6c3030204b31cc (patch) | |
tree | fac54493bfc0dc2d456e1dc72c92f4158eba38e2 | |
parent | 4393a2ea93547467aa578733a35a79aee3a528d5 (diff) |
svn merge -r126582:126583 svn+ssh://gcc.gnu.org/svn/gcc/trunk/
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_1-branch@126838 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/trans-openmp.c | 9 | ||||
-rw-r--r-- | gcc/fortran/trans-types.c | 2 | ||||
-rw-r--r-- | gcc/fortran/trans.h | 2 | ||||
-rw-r--r-- | libgomp/ChangeLog | 6 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/crayptr2.f90 | 30 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/pr32550.f90 | 20 |
7 files changed, 74 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8c4f0c4293c..fdfa4727991 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2007-07-12 Jakub Jelinek <jakub@redhat.com> + + PR fortran/32550 + * trans.h (GFC_POINTER_TYPE_P): Define. + * trans-types.c (gfc_sym_type): Set it for types on attr->sym.pointer. + * trans-openmp.c (gfc_omp_privatize_by_reference): Return false + if GFC_POINTER_TYPE_P is set on the type. + 2006-04-29 H.J. Lu <hongjiu.lu@intel.com> PR fortran/27351 diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 831426f5220..f748b9e6e5e 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -50,9 +50,12 @@ gfc_omp_privatize_by_reference (tree decl) if (TREE_CODE (type) == POINTER_TYPE) { - /* POINTER/ALLOCATABLE have aggregate types, all user variables - that have POINTER_TYPE type are supposed to be privatized - by reference. */ + /* Array POINTER/ALLOCATABLE have aggregate types, all user variables + that have POINTER_TYPE type and don't have GFC_POINTER_TYPE_P + set are supposed to be privatized by reference. */ + if (GFC_POINTER_TYPE_P (type)) + return false; + if (!DECL_ARTIFICIAL (decl)) return true; diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index cfff7e0569a..00a1c464256 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1324,6 +1324,8 @@ gfc_sym_type (gfc_symbol * sym) { if (sym->attr.allocatable || sym->attr.pointer) type = gfc_build_pointer_type (sym, type); + if (sym->attr.pointer) + GFC_POINTER_TYPE_P (type) = 1; } /* We currently pass all parameters by reference. diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 27f232f9599..96b1a9980e1 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -582,6 +582,8 @@ struct lang_decl GTY(()) #define GFC_DESCRIPTOR_TYPE_P(node) TYPE_LANG_FLAG_1(node) /* An array without a descriptor. */ #define GFC_ARRAY_TYPE_P(node) TYPE_LANG_FLAG_2(node) +/* Fortran POINTER type. */ +#define GFC_POINTER_TYPE_P(node) TYPE_LANG_FLAG_3(node) /* The GFC_TYPE_ARRAY_* members are present in both descriptor and descriptorless array types. */ #define GFC_TYPE_ARRAY_LBOUND(node, dim) \ diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index f9a4cc1ada7..b2a85d262c3 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,9 @@ +2007-07-12 Jakub Jelinek <jakub@redhat.com> + + PR fortran/32550 + * testsuite/libgomp.fortran/pr32550.f90: New test. + * testsuite/libgomp.fortran/crayptr2.f90: New test. + 2007-07-02 Jakub Jelinek <jakub@redhat.com> PR libgomp/32468 diff --git a/libgomp/testsuite/libgomp.fortran/crayptr2.f90 b/libgomp/testsuite/libgomp.fortran/crayptr2.f90 new file mode 100644 index 00000000000..f8fce6b4760 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/crayptr2.f90 @@ -0,0 +1,30 @@ +! { dg-do run } +! { dg-options "-fopenmp -fcray-pointer" } + + use omp_lib + integer :: a, b, c, d, p + logical :: l + pointer (ip, p) + save ip +!$omp threadprivate (ip) + a = 1 + b = 2 + c = 3 + l = .false. +!$omp parallel num_threads (3) reduction (.or.:l) + if (omp_get_thread_num () .eq. 0) then + ip = loc (a) + elseif (omp_get_thread_num () .eq. 1) then + ip = loc (b) + else + ip = loc (c) + end if + l = p .ne. omp_get_thread_num () + 1 +!$omp single + d = omp_get_thread_num () +!$omp end single copyprivate (d, ip) + l = l .or. (p .ne. d + 1) +!$omp end parallel + + if (l) call abort +end diff --git a/libgomp/testsuite/libgomp.fortran/pr32550.f90 b/libgomp/testsuite/libgomp.fortran/pr32550.f90 new file mode 100644 index 00000000000..907a768e6d5 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr32550.f90 @@ -0,0 +1,20 @@ +! PR fortran/32550 +! { dg-do run } + + integer, pointer, save :: ptr + integer, target :: targ + integer :: e +!$omp threadprivate(ptr) + e = 0 + targ = 42 +!$omp parallel shared(targ) +!$omp single + ptr => targ +!$omp end single copyprivate(ptr) + if (ptr.ne.42) then +!$omp atomic + e = e + 1 + end if +!$omp end parallel + if (e.ne.0) call abort + end |