aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2015-01-02 13:34:58 +0000
committerTobias Burnus <burnus@net-b.de>2015-01-02 13:34:58 +0000
commita2d66657988a17a7bc7d3e5954539729eef1870a (patch)
treeaaed31262b527da51678b25c953076b79c972526 /gcc/fortran/trans-decl.c
parentdc596ac2bf9abb18fa8972318d974770665b2b69 (diff)
2015-01-02 Tobias Burnus <burnus@net-b.de>
* trans-decl.c (gfc_build_qualified_array): Fix coarray tokens for module coarrays with -fcoarray=lib. 2015-01-02 Tobias Burnus <burnus@net-b.de> * gfortran.dg/coarray/codimension_2.f90: New. * gfortran.dg/coarray/codimension_2a.f90: New. * gfortran.dg/coarray_35.f90: New. * gfortran.dg/coarray_35a.f90: New. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@219142 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r--gcc/fortran/trans-decl.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 75b84f1495b..9ef6bfcda80 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -819,10 +819,22 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
&& GFC_TYPE_ARRAY_CAF_TOKEN (type) == NULL_TREE)
{
tree token;
+ tree token_type = build_qualified_type (pvoid_type_node,
+ TYPE_QUAL_RESTRICT);
+
+ if (sym->module && (sym->attr.use_assoc
+ || sym->ns->proc_name->attr.flavor == FL_MODULE))
+ {
+ tree token_name
+ = get_identifier (gfc_get_string (GFC_PREFIX ("caf_token%s"),
+ IDENTIFIER_POINTER (gfc_sym_mangled_identifier (sym))));
+ token = build_decl (DECL_SOURCE_LOCATION (decl), VAR_DECL, token_name,
+ token_type);
+ TREE_PUBLIC (token) = 1;
+ }
+ else
+ token = gfc_create_var_np (token_type, "caf_token");
- token = gfc_create_var_np (build_qualified_type (pvoid_type_node,
- TYPE_QUAL_RESTRICT),
- "caf_token");
GFC_TYPE_ARRAY_CAF_TOKEN (type) = token;
DECL_ARTIFICIAL (token) = 1;
TREE_STATIC (token) = 1;