aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@gcc.gnu.org>2015-01-02 14:34:58 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2015-01-02 14:34:58 +0100
commit213ab0a6c49f10069615b98d38bb794f844cf433 (patch)
treeaaed31262b527da51678b25c953076b79c972526 /gcc/fortran/trans-decl.c
parent4294c0935c186a724f044c36ca9693a7138853ae (diff)
downloadgcc-213ab0a6c49f10069615b98d38bb794f844cf433.zip
gcc-213ab0a6c49f10069615b98d38bb794f844cf433.tar.gz
gcc-213ab0a6c49f10069615b98d38bb794f844cf433.tar.bz2
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> * 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. From-SVN: r219142
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 75b84f1..9ef6bfc 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;