diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 14:16:54 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-07-12 14:16:54 +0200 |
commit | e1c8221962aa8dfba5b2462449bccfe10c2d561e (patch) | |
tree | 393a1c7458b43284abbfb7883e8b69cce2548c5f /gcc | |
parent | 99c1f1ceed0d85eb785cb6f49ef23cad965922d2 (diff) | |
download | gcc-e1c8221962aa8dfba5b2462449bccfe10c2d561e.zip gcc-e1c8221962aa8dfba5b2462449bccfe10c2d561e.tar.gz gcc-e1c8221962aa8dfba5b2462449bccfe10c2d561e.tar.bz2 |
re PR fortran/32550 (openmp: COPYPRIVATE of pointer variables fails)
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.
* testsuite/libgomp.fortran/pr32550.f90: New test.
* testsuite/libgomp.fortran/crayptr2.f90: New test.
From-SVN: r126583
Diffstat (limited to 'gcc')
-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 |
4 files changed, 18 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 20bf60b..ef75186 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. + 2007-07-12 Richard Guenther <rguenther@suse.de> * trans-intrinsic.c (gfc_conv_intrinsic_repeat): Convert diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 7c381db..b068330 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 dace23a..5af85f1 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1538,6 +1538,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 a57deca..02fe413 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -600,6 +600,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) \ |